Giter Site home page Giter Site logo

devopsglobalsolutions / packer-templates Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ruzickap/packer-templates

0.0 1.0 0.0 370 KB

Scripts and Templates used for generating Vagrant images (mainly for libvirt provider)

Shell 95.25% PowerShell 4.75%

packer-templates's Introduction

Packer Templates mainly for the Vagrant libvirt and virtualbox provider

Customized+Clean/Minimal boxes for libvirt and virtualbox provider

Build Status


Github repository for bug reports or feature requests:

https://github.com/ruzickap/packer-templates/

Vagrant Cloud repository for the images build by these templates

https://app.vagrantup.com/peru

Requirements

Login Credentials

(root/Administrator password is "vagrant" or is not set )

  • Username: vagrant
  • Password: vagrant

VM Specifications

Drivers / Devices added for the VMs for specific providers.

Libvirt

  • VirtIO dynamic Hard Disk (up to 50 GiB)
  • VirtIO Network Interface
  • QXL Video Card (SPICE display)
  • Channel Device (com.redhat.spice.0)

VirtualBox

  • SATA Disk

Configuration

Customized Linux installation

  • there are usually many customization depends on distribution - all are described in Ansible playbook.
  • added packages: see the Common list and Debian list or CentOS list
  • mouse disabled in Midnight Commander + other MC customizations
  • preconfigured snmpd, vim, screen
  • logrotate using xz instead of gzip
  • logwatch is running once per week instead of once per day
  • sshd is using only the strong algorithms
  • sysstat (sar) is running every minute instead of every 5 minutes

Minimal Linux installation

  • en_US.UTF-8
  • keymap for standard US keyboard
  • UTC timezone
  • NTP enabled (default configuration)
  • full-upgrade
  • unattended-upgrades
  • /dev/vda1 mounted on / using ext4/xfs filesystem (all files in one partition)
  • no swap

Minimal Windows installation

  • UTC timezone
  • IEHarden disabled
  • Home Page set to "about:blank"
  • First Run Wizard disabled
  • Firewall allows Remote Desktop connections
  • AutoActivation skipped
  • DoNotOpenInitialConfigurationTasksAtLogon set to true
  • WinRM (ssl) enabled
  • New Network Window turned off
  • Administrator account enabled
  • EnableLUA
  • Windows image was finalized using sysprep: unattended.xml

Additional Drivers installed for libvirt boxes - VirtIO

Installed during installation:

  • NetKVM: VirtIO Network driver
  • qxldod: QXL graphics driver
  • viostor: VirtIO Block driver (VirtIO SCSI controller driver)

Installed components via Ansible playbook win.yml for Windows:

  • vioscsi: Support for VirtIO SCSI pass-through controller
  • Balloon: VirtIO Memory Balloon driver
  • viorng: VirtIO RNG Device driver
  • vioser: VirtIO Serial Driver
  • vioinput: VirtIO Input Driver - support for new QEMU input devices virtio-keyboard-pci, virtio-mouse-pci, virtio-tablet-pci, virtio-input-host-pci
  • pvpanic: QEMU pvpanic device driver
  • qemu-ga: Qemu Guest Agent

Additional Drivers installed for virtualbox boxes

  • VirtualBox Guest Additions

How to build images remotely

If you want to build the images yourself you will need passwordless ssh access to the latest Fedora server and locally installed Ansible. The server should not have IPs from this range 192.168.121.0/24 - this is used by Vagrant + libvirt by default.

Then you just need to modify the REMOTE_IP and REMOTE_USER in build_remote_ssh.sh file.

The build_remote_ssh.sh script will connect to your Fedora server, downloads necessary packages (initiate reboot if necessary for kernel update) and start building the images using Packer. It will also test the newly created images by Vagrant. The whole procedure will take several hours. You can check the progress by sshing to the server and checking the log files in /tmp/ directory.

How to build images locally

If you have necessary software installed+configured on your local machine you can use the following commands to build the images. Here are the examples with build script build.sh and "pure packer way":

  • Ubuntu:
# Ubuntu Server
./build.sh ubuntu-server-18.04:libvirt
NAME=ubuntu-18.04-server-amd64 UBUNTU_VERSION=18.04 UBUNTU_TYPE=server UBUNTU_ARCH=amd64 packer build ubuntu-server.json
./build.sh ubuntu-server-16.04:libvirt
NAME=ubuntu-16.04-server-amd64 UBUNTU_VERSION=16.04.4 UBUNTU_TYPE=server UBUNTU_ARCH=amd64 packer build ubuntu-server.json
./build.sh ubuntu-server-14.04:libvirt
NAME=ubuntu-14.04-server-amd64 UBUNTU_VERSION=14.04.5 UBUNTU_TYPE=server UBUNTU_ARCH=amd64 packer build ubuntu-server.json

# Ubuntu Desktop
./build.sh ubuntu-desktop-18.04:libvirt
NAME=ubuntu-18.10-desktop-amd64 UBUNTU_VERSION=18.10 UBUNTU_TYPE=desktop UBUNTU_ARCH=amd64 packer build ubuntu-desktop.json
./build.sh ubuntu-desktop-17.10:libvirt
NAME=ubuntu-17.10-desktop-amd64 UBUNTU_VERSION=17.10.1 UBUNTU_TYPE=desktop UBUNTU_ARCH=amd64 packer build ubuntu-desktop.json

# Ubuntu Server - customized
./build.sh my_ubuntu-server-18.04:libvirt
NAME=my_ubuntu-18.04-server-amd64 UBUNTU_VERSION=18.04 UBUNTU_TYPE=server UBUNTU_ARCH=amd64 packer build my_ubuntu-server.json
./build.sh my_ubuntu-server-16.04:libvirt
NAME=my_ubuntu-16.04-server-amd64 UBUNTU_VERSION=16.04.4 UBUNTU_TYPE=server UBUNTU_ARCH=amd64 packer build my_ubuntu-server.json
./build.sh my_ubuntu-server-14.04:libvirt
NAME=my_ubuntu-14.04-server-amd64 UBUNTU_VERSION=14.04.5 UBUNTU_TYPE=server UBUNTU_ARCH=amd64 packer build my_ubuntu-server.json
  • Windows:
# Windows Server
./build.sh windows-2012_r2:libvirt windows-2012_r2:virtualbox
NAME=windows-server-2012-r2-standard-x64-eval WINDOWS_VERSION=2012 VIRTIO_WIN_ISO=/var/tmp/packer/virtio-win.iso ISO_CHECKSUM=6612b5b1f53e845aacdf96e974bb119a3d9b4dcb5b82e65804ab7e534dc7b4d5 ISO_URL=http://care.dlservice.microsoft.com/dl/download/6/2/A/62A76ABB-9990-4EFC-A4FE-C7D698DAEB96/9600.17050.WINBLUE_REFRESH.140317-1640_X64FRE_SERVER_EVAL_EN-US-IR3_SSS_X64FREE_EN-US_DV9.ISO packer build -only=qemu windows.json
./build.sh windows-2016:libvirt windows-2016:virtualbox
NAME=windows-server-2016-standard-x64-eval WINDOWS_VERSION=2016 VIRTIO_WIN_ISO=/var/tmp/packer/virtio-win.iso ISO_CHECKSUM=1ce702a578a3cb1ac3d14873980838590f06d5b7101c5daaccbac9d73f1fb50f ISO_URL=http://care.dlservice.microsoft.com/dl/download/1/4/9/149D5452-9B29-4274-B6B3-5361DBDA30BC/14393.0.161119-1705.RS1_REFRESH_SERVER_EVAL_X64FRE_EN-US.ISO packer build -only=qemu windows.json

# Windows 10
./build.sh windows-10:libvirt windows-10:virtualbox
NAME=windows-10-enterprise-x64-eval WINDOWS_VERSION=10 VIRTIO_WIN_ISO=/var/tmp/packer/virtio-win.iso ISO_CHECKSUM=3d39dd9bd37db5b3c80801ae44003802a9c770a7400a1b33027ca474a1a7c691 ISO_URL=http://care.dlservice.microsoft.com/dl/download/6/5/D/65D18931-F626-4A35-AD5B-F5DA41FE6B76/16299.15.170928-1534.rs3_release_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso packer build -only=qemu windows.json

# Windows 10 - customized
./build.sh my_windows-10:libvirt my_windows-10:virtualbox
NAME=my_windows-10-enterprise-x64-eval WINDOWS_VERSION=10 VIRTIO_WIN_ISO=/var/tmp/packer/virtio-win.iso ISO_CHECKSUM=3d39dd9bd37db5b3c80801ae44003802a9c770a7400a1b33027ca474a1a7c691 ISO_URL=http://care.dlservice.microsoft.com/dl/download/6/5/D/65D18931-F626-4A35-AD5B-F5DA41FE6B76/16299.15.170928-1534.rs3_release_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso packer build -only=qemu my_windows.json

Helper scripts

  • build.sh - build single image specified on command line
  • build_all.sh - builds all images
  • build_all_remote_ssh.sh - connects to remote Ubuntu server, install the necessary packages for building images and execute build_all.sh
  • vagrant_init_destroy_boxes.sh - tests all *.box images in the current directory using vagrant add/up/ssh/winrm/destroy

packer-templates's People

Contributors

ruzickap avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.