Loading...
 

Packer

  • https://github.com/ForestTechnologiesLtd/devopsplayground4-packer
  • https://www.packer.io
  • Fast infrastructure deployment
  • multi-provider support )
  • highly testable
  • Packer has a public repository
  • there are Packer repositories where boot_commands can be found
  • can run parallel builds by specifying multiple “type” objects in the “builders” section of template.json
  • command line arguments are order sensitive. (e.g. in packer build -var-file=config.json -var ‘NAME=Gaz’ template.json -var overrides -var-file).
  • integrates with Jenkins
  • compliments Ansible and Terraform

 

Packer components

  • builders (i.e. what type of machine)
  • description (human readable field)
  • min_packer_version (minimum version requirement of Packer binary)
  • post_processors (steps to create the images required. E.g. import AMI)
  • provisioners (extra software beyond operating system)
  • preseed.cfg file (contains the same information you enter when you setup a machine for the first time like time zone, keyboard layout, how to partition the hard drive, host name, etc.)
    • When you boot from the startup media (in this case an iso), you can choose the location of the preseed file via a url
    • The preseed file is uploaded into memory and the configuration is read
    • The installation process begins using information from the preseed file to enter the values where the user would normally enter them.
  • http://blog.endpoint.com/2014/03/provisioning-development-environment.html
  • http://kappataumu.com/articles/creating-an-Ubuntu-VM-with-packer.html
 
 

Pressed example:

choose-mirror-bin mirror/http/proxy string
d-i apt-setup/use_mirror boolean true
d-i base-installer/kernel/override-image string linux-server
d-i clock-setup/utc boolean true
d-i clock-setup/utc-auto boolean true
d-i finish-install/reboot_in_progress note
 
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i grub-installer/bootdev  string /dev/sda
 
d-i keymap select us
 
d-i mirror/country string manual
d-i mirror/http/directory string /debian
d-i mirror/http/hostname string http.debian.net
d-i mirror/http/proxy string
 
d-i partman-auto-lvm/guided_size string max
d-i partman-auto/choose_recipe select atomic
d-i partman-auto/method string lvm
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-lvm/device_remove_lvm boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman/confirm_write_new_label boolean true
 
d-i passwd/root-login boolean false
d-i passwd/root-password-again password 
d-i passwd/root-password password
d-i passwd/user-fullname string forest
d-i passwd/user-uid string 900
d-i passwd/user-password password forest
d-i passwd/user-password-again password forest
d-i passwd/username string forest
 
d-i pkgsel/include string openssh-server build-essential
d-i pkgsel/install-language-support boolean false
d-i pkgsel/update-policy select none
d-i pkgsel/upgrade select none
popularity-contest popularity-contest/participate boolean false
d-i pkgsel/updatedb boolean false
 
# Prevent packaged version of VirtualBox Guest Additions being installed:
d-i preseed/early_command string sed -i \
  ‘/in-target/idiscover(){/sbin/discover|grep -v VirtualBox;}’ \
  /usr/lib/pre-pkgsel.d/20install-hwpackages
 
d-i time/zone string UTC
d-i user-setup/allow-password-weak boolean true
d-i user-setup/encrypt-home boolean false
d-i preseed/late_command string sed -i ‘/
deb cdrom:/s/
/#/’ /target/etc/apt/sources.list
 
apt-cdrom-setup apt-setup/cdrom/set-first boolean false
apt-mirror-setup apt-setup/use_mirror boolean true
popularity-contest popularity-contest/participate boolean false
tasksel tasksel/first multiselect standard, ubuntu-server