Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit eb96e26

Browse files
author
Jamie Snape
committed
Add Packer provisioning scripts
1 parent b990360 commit eb96e26

File tree

3 files changed

+179
-0
lines changed

3 files changed

+179
-0
lines changed

provisioning/packer/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Midas Server. Copyright Kitware SAS. Licensed under the Apache License 2.0.
2+
3+
output-*/
4+
packer_cache/
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Midas Server. Copyright Kitware SAS. Licensed under the Apache License 2.0.
2+
3+
d-i debian-installer/language string en
4+
d-i debian-installer/country string US
5+
d-i debian-installer/locale string en_US
6+
d-i localechooser/preferred-locale string en_US.UTF-8
7+
d-i localechooser/supported-locales en_US.UTF-8
8+
9+
d-i console-setup/ask_detect boolean false
10+
d-i keyboard-configuration/layoutcode string us
11+
d-i keyboard-configuration/modelcode string pc104
12+
13+
d-i netcfg/get_hostname string unassigned-hostname
14+
d-i netcfg/get_domain string unassigned-domain
15+
16+
d-i mirror/http/proxy string
17+
18+
d-i time/zone string UTC
19+
d-i clock-setup/utc-auto boolean true
20+
d-i clock-setup/utc boolean true
21+
22+
d-i partman-auto/method string lvm
23+
d-i partman-lvm/confirm boolean true
24+
d-i partman-lvm/device_remove_lvm boolean true
25+
d-i partman-auto/choose_recipe select atomic
26+
27+
d-i partman/confirm_write_new_label boolean true
28+
d-i partman/confirm_nooverwrite boolean true
29+
d-i partman/choose_partition select finish
30+
d-i partman/confirm boolean true
31+
32+
d-i partman-lvm/confirm boolean true
33+
d-i partman-lvm/confirm_nooverwrite boolean true
34+
d-i partman-auto-lvm/guided_size string max
35+
36+
d-i passwd/user-fullname string vagrant
37+
d-i passwd/username string vagrant
38+
d-i passwd/user-password password vagrant
39+
d-i passwd/user-password-again password vagrant
40+
41+
d-i user-setup/encrypt-home boolean false
42+
d-i user-setup/allow-password-weak boolean true
43+
44+
d-i debconf debconf/frontend select Noninteractive
45+
46+
tasksel tasksel/first multiselect standard, server, openssh-server
47+
48+
d-i pkgsel/install-language-support boolean false
49+
d-i pkgsel/update-policy select none
50+
d-i pkgsel/upgrade select full-upgrade
51+
52+
d-i grub-installer/only_debian boolean true
53+
54+
d-i finish-install/reboot_in_progress note

provisioning/packer/template.json

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
{
2+
"builders": [
3+
{
4+
"type": "virtualbox-iso",
5+
"iso_checksum": "8acd2f56bfcba2f7ac74a7e4a5e565ce68c024c38525c0285573e41c86ae90c0",
6+
"iso_checksum_type": "sha256",
7+
"iso_url": "http://releases.ubuntu.com/trusty/ubuntu-14.04.2-server-amd64.iso",
8+
"ssh_username": "vagrant",
9+
"boot_command": [
10+
"<esc><esc><enter><wait>",
11+
"/install/vmlinuz noapic preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
12+
"debian-installer=en_US auto locale=en_US kbd-chooser/method=us hostname={{ .Name }} ",
13+
"fb=false debconf/frontend=noninteractive console-setup/ask_detect=false ",
14+
"keyboard-configuration/layoutcode=us keyboard-configuration/modelcode=pc104 ",
15+
"initrd=/install/initrd.gz -- <enter>"
16+
],
17+
"boot_wait": "3s",
18+
"disk_size": "40000",
19+
"guest_os_type": "Ubuntu_64",
20+
"http_directory": "http",
21+
"shutdown_command": "/bin/echo 'vagrant' | /usr/bin/sudo -S /sbin/shutdown -P now",
22+
"ssh_password": "vagrant",
23+
"vboxmanage": [
24+
["modifyvm", "{{.Name}}", "--cpus", "2"],
25+
["modifyvm", "{{.Name}}", "--memory", "4096"]
26+
],
27+
"vm_name": "midas-server-{{timestamp}}"
28+
},
29+
{
30+
"type": "vmware-iso",
31+
"iso_checksum": "8acd2f56bfcba2f7ac74a7e4a5e565ce68c024c38525c0285573e41c86ae90c0",
32+
"iso_checksum_type": "sha256",
33+
"iso_url": "http://releases.ubuntu.com/trusty/ubuntu-14.04.2-server-amd64.iso",
34+
"ssh_username": "vagrant",
35+
"boot_command": [
36+
"<esc><esc><enter><wait>",
37+
"/install/vmlinuz noapic preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
38+
"debian-installer=en_US auto locale=en_US kbd-chooser/method=us hostname={{ .Name }} ",
39+
"fb=false debconf/frontend=noninteractive console-setup/ask_detect=false ",
40+
"keyboard-configuration/layoutcode=us keyboard-configuration/modelcode=pc104 ",
41+
"initrd=/install/initrd.gz -- <enter>"
42+
],
43+
"boot_wait": "3s",
44+
"disk_size": "40000",
45+
"guest_os_type": "ubuntu-64",
46+
"http_directory": "http",
47+
"shutdown_command": "/bin/echo 'vagrant' | /usr/bin/sudo -S /sbin/shutdown -P now",
48+
"ssh_password": "vagrant",
49+
"tools_upload_flavor": "linux",
50+
"vm_name": "midas-server-{{timestamp}}",
51+
"vmdk_name": "midas-server-{{timestamp}}",
52+
"vmx_data": {
53+
"memsize": "4096",
54+
"numvcpus": "2"
55+
}
56+
}
57+
],
58+
"provisioners": [
59+
{
60+
"type": "shell",
61+
"inline": [
62+
"/bin/echo %vagrant ALL=NOPASSWD:ALL > /etc/sudoers.d/vagrant",
63+
"/bin/chmod 0440 /etc/sudoers.d/vagrant"
64+
],
65+
"execute_command": "/bin/echo 'vagrant' | {{.Vars}} /usr/bin/sudo -E -S /bin/bash '{{.Path}}'"
66+
},
67+
{
68+
"type": "shell",
69+
"inline": [
70+
"/usr/bin/apt-get -qq update",
71+
"/usr/bin/apt-get -q -y -o Dpkg::Options::=--force-confdef -o DPkg::Options::=--force-confnew dist-upgrade",
72+
"/usr/bin/apt-get -q -y -o Dpkg::Options::=--force-confdef -o DPkg::Options::=--force-confnew install git nfs-common ntp software-properties-common",
73+
"/usr/bin/apt-add-repository -y ppa:ansible/ansible",
74+
"/usr/bin/apt-get -qq update",
75+
"/usr/bin/apt-get -q -y -o Dpkg::Options::=--force-confdef -o DPkg::Options::=--force-confnew install ansible",
76+
"/usr/bin/git clone https://github.com/midasplatform/Midas.git /vagrant",
77+
"/bin/chown -R vagrant:vagrant /vagrant"
78+
],
79+
"execute_command": "{{.Vars}} /usr/bin/sudo -E /bin/bash '{{.Path}}'"
80+
},
81+
{
82+
"type": "shell",
83+
"inline": [
84+
"/usr/bin/apt-get -q -y -o Dpkg::Options::=--force-confdef -o DPkg::Options::=--force-confnew install dkms",
85+
"/bin/mount -o loop /home/vagrant/VBoxGuestAdditions.iso /mnt",
86+
"/usr/bin/yes | /bin/bash /mnt/VBoxLinuxAdditions.run",
87+
"/bin/umount /mnt",
88+
"/bin/rm -f /home/vagrant/VBoxGuestAdditions.iso"
89+
],
90+
"execute_command": "{{.Vars}} /usr/bin/sudo -E /bin/bash '{{.Path}}'",
91+
"only": ["virtualbox-iso"]
92+
},
93+
{
94+
"type": "shell",
95+
"inline": [
96+
"/usr/bin/apt-get -q -y -o Dpkg::Options::=--force-confdef -o DPkg::Options::=--force-confnew install build-essential linux-headers-$(/bin/uname -r)",
97+
"/bin/mount -o loop /home/vagrant/linux.iso /mnt",
98+
"/bin/tar -xf /mnt/VMwareTools-*.tar.gz -C /tmp",
99+
"/bin/bash /tmp/vmware-tools-distrib/vmware-install.pl -d",
100+
"/bin/umount /mnt",
101+
"/bin/rm -rf /tmp/vmware-tools-distrib",
102+
"/bin/rm -f /home/vagrant/linux.iso"
103+
],
104+
"execute_command": "{{.Vars}} /usr/bin/sudo -E /bin/bash '{{.Path}}'",
105+
"only": ["vmware-iso"]
106+
},
107+
{
108+
"type": "ansible-local",
109+
"playbook_file": "../ansible/site.yml",
110+
"playbook_dir": "../ansible"
111+
},
112+
{
113+
"type": "shell",
114+
"inline": [
115+
"/usr/bin/apt-get -q -y autoremove",
116+
"/usr/bin/apt-get -q -y clean"
117+
],
118+
"execute_command": "{{.Vars}} /usr/bin/sudo -E /bin/bash '{{.Path}}'"
119+
}
120+
]
121+
}

0 commit comments

Comments
 (0)