-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add packer template and documentation to generate VMware OVAs
Added a packer template to generate lab VM on VMware using Ubuntu 16.04 as base. Made minor changes to bootstrap.sh to accomodate more recent Ubuntu release including installing extra packages required for Ubuntu 16.04 and to skip update of grub menu.lst, which no longer exists. Added preseed.cfg file to create sudo-enabled ubuntu account required for lab. Added README.md to document usage and edited top-level README.md to refer to VMware as well as AWS.
- Loading branch information
Robert Hodges
committed
Apr 20, 2018
1 parent
01ce4e4
commit 83a37a6
Showing
7 changed files
with
165 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
packer_cache/ | ||
packer-rubber-docker-ubuntu-16.04-vmware/ | ||
rubber-docker-ubuntu-16.04.ova |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Building Rubber-Docker Workshop VMs | ||
|
||
## Overview | ||
|
||
This directory has two packer.json files that you can use to construct | ||
VMs for the lab. You'll need to [download | ||
packer](https://www.packer.io/downloads.html) or [build it from | ||
source](https://www.packer.io/docs/install/index.html#compiling-from-source). | ||
|
||
Login using ubuntu/ubuntu for both VMs. | ||
|
||
## AWS AMI | ||
|
||
Set your AWS credentials as environmental variables and fill in a valid | ||
subnet ID from your VPC in rubber-docker-aws.json, then execute: | ||
``` | ||
packer build rubber-docker-aws.json | ||
``` | ||
Note that the source AMI is not accessible outside the region given | ||
in the packer build file. | ||
|
||
## VMware OVA | ||
|
||
Build on Mac OS X. In addition to packer you'll need VMware Fusion | ||
and ovftool. Execute the following: | ||
|
||
``` | ||
packer build rubber-docker-vmware.json | ||
ovftool packer-rubber-docker-ubuntu-16.04-vmware/rubber-docker-ubuntu-16.04.vmx rubber-docker-ubuntu-16.04.ova | ||
``` | ||
The OVA is optional. You can also just start the VM directly in | ||
VMware Fusion. | ||
|
||
Note: The external network interface name on the VM may switch from | ||
ens33 to ens32 when you export to ovftool and boot. If this occurs | ||
edit /etc/network/interfaces and switch the interface name to the | ||
correct value. | ||
|
||
## Licensing | ||
|
||
VMware packer file rubber-docker-vmware.json and preseed.cfg are derived | ||
from similar files published at | ||
https://github.com/geerlingguy/packer-ubuntu-1604 under the [MIT license](https://opensource.org/licenses/MIT). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
choose-mirror-bin mirror/http/proxy string | ||
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 partman-auto/disk string /dev/sda | ||
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 pkgsel/include string openssh-server cryptsetup build-essential libssl-dev libreadline-dev zlib1g-dev linux-source dkms nfs-common | ||
d-i pkgsel/install-language-support boolean false | ||
d-i pkgsel/update-policy select none | ||
d-i pkgsel/upgrade select full-upgrade | ||
d-i time/zone string UTC | ||
tasksel tasksel/first multiselect standard, ubuntu-server | ||
|
||
d-i console-setup/ask_detect boolean false | ||
d-i keyboard-configuration/layoutcode string us | ||
d-i keyboard-configuration/modelcode string pc105 | ||
d-i debian-installer/locale string en_US | ||
|
||
# Create ubuntu user account. | ||
d-i passwd/user-fullname string ubuntu | ||
d-i passwd/username string ubuntu | ||
d-i passwd/user-password password ubuntu | ||
d-i passwd/user-password-again password ubuntu | ||
d-i user-setup/allow-password-weak boolean true | ||
d-i user-setup/encrypt-home boolean false | ||
d-i passwd/user-default-groups ubuntu sudo | ||
d-i passwd/user-uid string 900 | ||
|
||
# Enable passwordless sudo for ubuntu so other config scripts can work. | ||
d-i preseed/late_command string \ | ||
echo 'ubuntu ALL=(ALL) NOPASSWD: ALL' > /target/etc/sudoers.d/ubuntu ; \ | ||
in-target chmod 440 /etc/sudoers.d/ubuntu ; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"builders": [ | ||
{ | ||
"type": "vmware-iso", | ||
"boot_command": [ | ||
"<enter><wait><f6><esc><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", | ||
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", | ||
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", | ||
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", | ||
"/install/vmlinuz<wait>", | ||
" auto<wait>", | ||
" console-setup/ask_detect=false<wait>", | ||
" console-setup/layoutcode=us<wait>", | ||
" debconf/frontend=noninteractive<wait>", | ||
" debian-installer=en_US<wait>", | ||
" fb=false<wait>", | ||
" initrd=/install/initrd.gz<wait>", | ||
" keyboard-configuration/layout=USA<wait>", | ||
" keyboard-configuration/variant=USA<wait>", | ||
" locale=en_US<wait>", | ||
" netcfg/get_domain=vm<wait>", | ||
" netcfg/get_hostname=rubber-docker<wait>", | ||
" grub-installer/bootdev=/dev/sda<wait>", | ||
" noapic<wait>", | ||
" preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg", | ||
" -- <wait>", | ||
"<enter><wait>" | ||
], | ||
"boot_wait": "10s", | ||
"disk_size": 20480, | ||
"guest_os_type": "ubuntu-64", | ||
"headless": true, | ||
"http_directory": "http", | ||
"iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.4-server-amd64.iso", | ||
"iso_checksum_type": "sha256", | ||
"iso_checksum": "0a03608988cfd2e50567990dc8be96fb3c501e198e2e6efcb846d89efc7b89f2", | ||
"output_directory": "packer-rubber-docker-ubuntu-16.04-vmware", | ||
"shutdown_command": "echo 'ubuntu'|sudo -S shutdown -P now", | ||
"ssh_password": "ubuntu", | ||
"ssh_port": 22, | ||
"ssh_username": "ubuntu", | ||
"ssh_wait_timeout": "10000s", | ||
"tools_upload_flavor": "linux", | ||
"vm_name": "rubber-docker-ubuntu-16.04", | ||
"vmx_data": { | ||
"cpuid.coresPerSocket": "1", | ||
"memsize": "1024", | ||
"numvcpus": "1" | ||
} | ||
} | ||
], | ||
"provisioners": [ | ||
{ | ||
"type": "file", | ||
"source": "vimrc", | ||
"destination": "/tmp/vimrc" | ||
}, | ||
{ | ||
"type": "shell", | ||
"script": "bootstrap.sh" | ||
} | ||
] | ||
} |