forked from thatsamguy/packer-templates
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
schoolbox ubuntu-1804-php71 vagrant dev box
- Loading branch information
1 parent
9bd4a4e
commit 881bbbb
Showing
7 changed files
with
331 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
choose-mirror-bin mirror/http/proxy string | ||
d-i base-installer/kernel/override-image string linux-server | ||
d-i clock-setup/utc-auto boolean true | ||
d-i clock-setup/utc boolean true | ||
d-i console-setup/ask_detect boolean false | ||
d-i debian-installer/locale string en_AU.utf8 | ||
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 keyboard-configuration/layoutcode string us | ||
d-i keyboard-configuration/modelcode string pc104 | ||
d-i partman-auto/choose_recipe select atomic | ||
d-i partman-auto-lvm/guided_size string max | ||
d-i partman-auto/method string lvm | ||
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 partman-lvm/confirm boolean true | ||
d-i partman-lvm/confirm_nooverwrite boolean true | ||
d-i partman-lvm/device_remove_lvm boolean true | ||
d-i passwd/user-default-groups vagrant sudo | ||
d-i passwd/user-fullname string vagrant | ||
d-i passwd/username string vagrant | ||
d-i passwd/user-password-again password vagrant | ||
d-i passwd/user-password password vagrant | ||
d-i passwd/user-uid string 900 | ||
d-i pkgsel/include string openssh-server | ||
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 Australia/Victoria | ||
d-i user-setup/allow-password-weak boolean true | ||
d-i user-setup/encrypt-home boolean false | ||
tasksel tasksel/first multiselect standard, ubuntu-server |
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,11 @@ | ||
# Install the Linux headers | ||
apt-get -y install build-essential linux-headers-$(uname -r) | ||
|
||
# Install the VMware Fusion guest tools | ||
cd /tmp | ||
mkdir -p /mnt/cdrom | ||
mount -o loop ~/linux.iso /mnt/cdrom | ||
tar zxf /mnt/cdrom/VMwareTools-*.tar.gz -C /tmp/ | ||
/tmp/vmware-tools-distrib/vmware-install.pl -d | ||
rm /home/vagrant/linux.iso | ||
umount /mnt/cdrom |
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,9 @@ | ||
#!/bin/bash | ||
|
||
apt-get update | ||
apt-get upgrade -y | ||
|
||
# reboot | ||
echo "Rebooting the machine..." | ||
reboot | ||
sleep 60 |
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,34 @@ | ||
#!/bin/bash | ||
|
||
# Record build date | ||
date '+%s' >> /home/vagrant/.vagrant.buildtimestamp | ||
|
||
# Set up sudo | ||
echo %vagrant ALL=NOPASSWD:ALL > /etc/sudoers.d/vagrant | ||
chmod 0440 /etc/sudoers.d/vagrant | ||
|
||
# Setup sudo to allow no-password sudo for "sudo" | ||
usermod -a -G sudo vagrant | ||
|
||
# Installing vagrant keys | ||
mkdir /home/vagrant/.ssh | ||
chmod 700 /home/vagrant/.ssh | ||
cd /home/vagrant/.ssh | ||
wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys | ||
chmod 600 /home/vagrant/.ssh/authorized_keys | ||
chown -R vagrant /home/vagrant/.ssh | ||
|
||
# Download and Install PuppetLabs Offical Repository | ||
wget http://apt.puppetlabs.com/puppet-release-bionic.deb | ||
dpkg -i puppet-release-bionic.deb | ||
rm -f puppet-release-bionic.deb | ||
|
||
# Install NFS for Vagrant | ||
apt-get update | ||
apt-get install -y nfs-common | ||
|
||
# Installing puppet from packages | ||
apt-get install -y puppet-agent | ||
|
||
# Install some base dependencies | ||
apt-get install -y gpg software-properties-common vim |
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,9 @@ | ||
# Install the VirtualBox guest additions | ||
VBOX_VERSION=$(cat /home/vagrant/.vbox_version) | ||
VBOX_ISO=VBoxGuestAdditions_$VBOX_VERSION.iso | ||
mount -o loop $VBOX_ISO /mnt | ||
yes|sh /mnt/VBoxLinuxAdditions.run | ||
umount /mnt | ||
|
||
#Cleanup VirtualBox | ||
rm $VBOX_ISO |
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,23 @@ | ||
#!/bin/bash | ||
|
||
# Remove apt download cache | ||
rm /var/cache/apt/archives/* | ||
|
||
# Removing leftover leases and persistent rules | ||
echo "cleaning up dhcp leases" | ||
rm /var/lib/dhcp/* | ||
|
||
# Make sure Udev doesn't block our network | ||
echo "cleaning up udev rules" | ||
rm /etc/udev/rules.d/70-persistent-net.rules | ||
mkdir /etc/udev/rules.d/70-persistent-net.rules | ||
rm -rf /dev/.udev/ | ||
rm /lib/udev/rules.d/75-persistent-net-generator.rules | ||
|
||
echo "Adding a 2 sec delay to the interface up, to make the dhclient happy" | ||
echo "pre-up sleep 2" >> /etc/network/interfaces | ||
|
||
# Zero out the free space to save space in the final image: | ||
echo "Zeroing device to make space..." | ||
dd if=/dev/zero of=/EMPTY bs=1M | ||
rm -f /EMPTY |
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,210 @@ | ||
{ | ||
"builders": [ | ||
{ | ||
"type": "vmware-iso", | ||
"iso_url": "http://cdimage.ubuntu.com/releases/18.04/release/ubuntu-18.04.1-server-amd64.iso", | ||
"iso_checksum": "a5b0ea5918f850124f3d72ef4b85bda82f0fcd02ec721be19c1a6952791c8ee8", | ||
"iso_checksum_type": "sha256", | ||
"boot_wait": "5s", | ||
"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>", | ||
" console-setup/modelcode=pc105<wait>", | ||
" debconf/frontend=noninteractive<wait>", | ||
" debian-installer=en_US<wait>", | ||
" fb=false<wait>", | ||
" initrd=/install/initrd.gz<wait>", | ||
" kbd-chooser/method=us<wait>", | ||
" keyboard-configuration/layout=USA<wait>", | ||
" keyboard-configuration/variant=USA<wait>", | ||
" locale=en_US<wait>", | ||
" netcfg/get_domain=vm<wait>", | ||
" netcfg/get_hostname={{ .Name }}<wait>", | ||
" grub-installer/bootdev=/dev/sda<wait>", | ||
" noapic<wait>", | ||
" preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg", | ||
" -- <wait>", | ||
"<enter><wait>" | ||
], | ||
"disk_size": 46080, | ||
"vmx_data": { | ||
"cpuid.coresPerSocket": "1", | ||
"memsize": "512", | ||
"numvcpus": "2" | ||
}, | ||
"http_directory": "http", | ||
"shutdown_command": "echo 'vagrant' | sudo -S shutdown -P now", | ||
"ssh_wait_timeout": "20m", | ||
"ssh_username": "vagrant", | ||
"ssh_password": "vagrant", | ||
"ssh_port": 22, | ||
"tools_upload_flavor": "linux", | ||
"vm_name": "ubuntu-1804-php71.vagrant" | ||
}, | ||
{ | ||
"type": "virtualbox-iso", | ||
"iso_url": "http://cdimage.ubuntu.com/releases/18.04/release/ubuntu-18.04.1-server-amd64.iso", | ||
"iso_checksum": "a5b0ea5918f850124f3d72ef4b85bda82f0fcd02ec721be19c1a6952791c8ee8", | ||
"iso_checksum_type": "sha256", | ||
"boot_wait": "5s", | ||
"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>", | ||
" console-setup/modelcode=pc105<wait>", | ||
" debconf/frontend=noninteractive<wait>", | ||
" debian-installer=en_US<wait>", | ||
" fb=false<wait>", | ||
" initrd=/install/initrd.gz<wait>", | ||
" kbd-chooser/method=us<wait>", | ||
" keyboard-configuration/layout=USA<wait>", | ||
" keyboard-configuration/variant=USA<wait>", | ||
" locale=en_US<wait>", | ||
" netcfg/get_domain=vm<wait>", | ||
" netcfg/get_hostname={{ .Name }}<wait>", | ||
" grub-installer/bootdev=/dev/sda<wait>", | ||
" noapic<wait>", | ||
" preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg", | ||
" -- <wait>", | ||
"<enter><wait>" | ||
], | ||
"disk_size": 46080, | ||
"vboxmanage": [ | ||
[ | ||
"modifyvm", | ||
"{{.Name}}", | ||
"--memory", | ||
"512" | ||
], | ||
[ | ||
"modifyvm", | ||
"{{.Name}}", | ||
"--cpus", | ||
"2" | ||
] | ||
], | ||
"http_directory": "http", | ||
"shutdown_command": "echo 'shutdown -P now' > shutdown.sh; echo 'vagrant'|sudo -S sh 'shutdown.sh'", | ||
"ssh_wait_timeout": "20m", | ||
"ssh_password": "vagrant", | ||
"ssh_username": "vagrant", | ||
"ssh_port": 22, | ||
"guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso", | ||
"guest_os_type": "Ubuntu_64", | ||
"virtualbox_version_file": ".vbox_version", | ||
"vm_name": "ubuntu-1804-php71.vagrant" | ||
} | ||
], | ||
|
||
"provisioners": [ | ||
{ | ||
"type": "shell", | ||
"script": "scripts/kernel.sh", | ||
"expect_disconnect": true, | ||
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'" | ||
}, | ||
{ | ||
"type": "shell", | ||
"script": "scripts/vagrant.sh", | ||
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'" | ||
}, | ||
{ | ||
"type": "shell", | ||
"script": "scripts/fusion.sh", | ||
"override": { | ||
"virtualbox-iso": { | ||
"execute_command": "/bin/true" | ||
}, | ||
"vmware-iso": { | ||
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'" | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "shell", | ||
"script": "scripts/virtualbox.sh", | ||
"override": { | ||
"virtualbox-iso": { | ||
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'" | ||
}, | ||
"vmware-iso": { | ||
"execute_command": "/bin/true" | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "file", | ||
"source": "/$LOCALPATHTOGITREPO/puppet-alaress/hieradata", | ||
"destination": "/tmp/hieradata" | ||
}, | ||
{ | ||
"type": "file", | ||
"source": "/$LOCALPATHTOGITREPO/puppet-alaress/environments/production/modules", | ||
"destination": "/tmp/puppet-modules" | ||
}, | ||
{ | ||
"type": "file", | ||
"source": "/$LOCALPATHTOGITREPO/puppet-alaress/environments/production/hiera.yaml", | ||
"destination": "/tmp/hiera.yaml" | ||
}, | ||
{ | ||
"type": "file", | ||
"source": "/$LOCALPATHTOGITREPO/puppet-alaress/environments/production/manifests/site.pp", | ||
"destination": "/tmp/site.pp" | ||
}, | ||
{ | ||
"type": "shell", | ||
"inline": [ | ||
"sudo mkdir -vp /etc/puppetlabs/code/hieradata", | ||
"sudo mkdir -vp /etc/puppetlabs/code/hieradata/node", | ||
"sudo mkdir -vp /etc/puppetlabs/code/hieradata/os", | ||
"sudo mkdir -vp /etc/puppetlabs/code/manifests", | ||
"sudo mkdir -vp /etc/puppetlabs/code/modules", | ||
"sudo cp -v /tmp/hieradata/common.yaml /etc/puppetlabs/code/hieradata/", | ||
"sudo cp -v /tmp/hieradata/os/bionic.yaml /etc/puppetlabs/code/hieradata/os/", | ||
"sudo cp -v /tmp/hieradata/node/*vagrant.yaml /etc/puppetlabs/code/hieradata/node/", | ||
"sudo cp -r /tmp/puppet-modules/* /etc/puppetlabs/code/modules", | ||
"sudo cp /tmp/hiera.yaml /etc/puppetlabs/code/hiera.yaml", | ||
"sudo cp /tmp/site.pp /etc/puppetlabs/code/manifests/site.pp", | ||
"rm -rf /tmp/{hieradata,puppet-modules,hiera.yaml,site.pp}" | ||
] | ||
}, | ||
{ | ||
"manifest_file": "/$LOCALPATHTOGITREPO/puppet-alaress/environments/production/manifests/site.pp", | ||
"type": "puppet-masterless", | ||
"execute_command": "echo 'vagrant'|sudo -S /opt/puppetlabs/bin/puppet apply --verbose --modulepath=/etc/puppetlabs/code/modules --hiera_config=/etc/puppetlabs/code/hiera.yaml {{.ManifestFile}}" | ||
}, | ||
{ | ||
"type": "shell", | ||
"inline": [ | ||
"rm -rf /etc/puppetlabs/code/{hieradata,modules,hiera.yaml,manifests}" | ||
] | ||
}, | ||
{ | ||
"type": "shell", | ||
"scripts": [ | ||
"scripts/vm_cleanup.sh" | ||
], | ||
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'" | ||
} | ||
], | ||
|
||
"post-processors": [ | ||
{ | ||
"type": "vagrant", | ||
"keep_input_artifact": false | ||
} | ||
] | ||
} | ||
|