Skip to content
Snippets Groups Projects
Commit 1b64bd46 authored by Mike Marchetti's avatar Mike Marchetti
Browse files

Add packer scripts for vagrant image generation


Change-Id: If163c456b756f6c7c8a7a197dabc8eb3b1fc7907
Signed-off-by: default avatarMike Marchetti <mmarchetti@sandvine.com>
parent 0ebde16b
No related branches found
No related tags found
No related merge requests found
output-virtualbox-iso/
packer_cache/
builds/
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 vagrant user account.
d-i passwd/user-fullname string vagrant
d-i passwd/username string vagrant
d-i passwd/user-password password vagrant
d-i passwd/user-password-again password vagrant
d-i user-setup/allow-password-weak boolean true
d-i user-setup/encrypt-home boolean false
d-i passwd/user-default-groups vagrant sudo
d-i passwd/user-uid string 900
#!/bin/sh
apt autoremove
apt update
rm -f /home/vagrant/*.sh
wget --no-check-certificate https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub -O /home/vagrant/.ssh/authorized_keys
chmod 0600 /home/vagrant/.ssh/authorized_keys
chown -R vagrant:vagrant /home/vagrant/.ssh
dd if=/dev/zero of=/EMPTY bs=1M
rm -f /EMPTY
sync
#!/bin/bash
export PATH=$PATH:/snap/bin
echo "PATH=$PATH"
juju status
wget "$1"
chmod +x install_osm.sh
./install_osm.sh --nolxd -y --vimemu
#!/bin/sh
sudo apt -y update && apt-get -y upgrade
sudo apt -y install git wget curl vim snapd docker.io zfs lxd software-properties-common
#!/bin/sh
sudo snap install juju --classic
# WARNING: This file is generated by a debconf template!
# It is recommended to update it by using "dpkg-reconfigure -p medium lxd"
# Whether to setup a new bridge or use an existing one
USE_LXD_BRIDGE="true"
# Bridge name
# This is still used even if USE_LXD_BRIDGE is set to false
# set to an empty value to fully disable
LXD_BRIDGE="lxdbr0"
# Update the "default" LXD profile
UPDATE_PROFILE="true"
# Path to an extra dnsmasq configuration file
LXD_CONFILE=""
# DNS domain for the bridge
LXD_DOMAIN="lxd"
# IPv4
## IPv4 address (e.g. 10.0.8.1)
LXD_IPV4_ADDR="10.49.16.1"
## IPv4 netmask (e.g. 255.255.255.0)
LXD_IPV4_NETMASK="255.255.255.0"
## IPv4 network (e.g. 10.0.8.0/24)
LXD_IPV4_NETWORK="10.49.16.1/24"
## IPv4 DHCP range (e.g. 10.0.8.2,10.0.8.254)
LXD_IPV4_DHCP_RANGE="10.49.16.2,10.49.16.254"
## IPv4 DHCP number of hosts (e.g. 250)
LXD_IPV4_DHCP_MAX="252"
## NAT IPv4 traffic
LXD_IPV4_NAT="true"
# IPv6
## IPv6 address (e.g. 2001:470:b368:4242::1)
LXD_IPV6_ADDR=""
## IPv6 CIDR mask (e.g. 64)
LXD_IPV6_MASK=""
## IPv6 network (e.g. 2001:470:b368:4242::/64)
LXD_IPV6_NETWORK=""
## NAT IPv6 traffic
LXD_IPV6_NAT="false"
# Run a minimal HTTP PROXY server
LXD_IPV6_PROXY="false"
sudo lxd init --auto --storage-backend zfs --storage-pool lxdpool --storage-create-loop 20
sudo systemctl stop lxd-bridge
sudo systemctl --system daemon-reload
sudo cp -f /tmp/lxd-bridge /etc/default/lxd-bridge
sudo systemctl enable lxd-bridge
sudo systemctl start lxd-bridge
sudo usermod -a -G lxd $(whoami)
#!/bin/sh
echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
echo 'APT::Periodic::Enable "0";' >> /etc/apt/apt.conf.d/10periodic
{
"provisioners": [
{
"type": "shell",
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
"script": "scripts/install_packages.sh"
},
{
"type": "shell",
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
"script": "scripts/setup.sh"
},
{
"type": "file",
"source": "scripts/lxd-bridge",
"destination": "/tmp/lxd-bridge"
},
{
"type": "shell",
"script": "scripts/lxd-setup.sh"
},
{
"type": "shell",
"script": "scripts/juju-setup.sh"
}
],
"builders": [
{
"type": "virtualbox-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>",
" 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=vagrant<wait>",
" grub-installer/bootdev=/dev/sda<wait>",
" noapic<wait>",
" preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg",
" -- <wait>",
"<enter><wait>"
],
"boot_wait": "10s",
"disk_size": 15360,
"guest_os_type": "Ubuntu_64",
"headless": true,
"http_directory": "http",
"iso_urls": [
"iso/ubuntu-16.04.4-server-amd64.iso",
"http://releases.ubuntu.com/16.04/ubuntu-16.04.4-server-amd64.iso"
],
"iso_checksum_type": "sha256",
"iso_checksum": "0a03608988cfd2e50567990dc8be96fb3c501e198e2e6efcb846d89efc7b89f2",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_port": 22,
"ssh_wait_timeout": "10000s",
"shutdown_command": "echo 'vagrant'|sudo -S shutdown -P now",
"guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",
"virtualbox_version_file": ".vbox_version",
"vm_name": "packer-ubuntu-16.04-amd64-juju",
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--memory",
"4096"
],
[
"modifyvm",
"{{.Name}}",
"--cpus",
"2"
]
]
}
]
}
{
"provisioners": [
{
"type": "shell",
"script": "scripts/get-install-osm.sh",
"execute_command": "{{.Path}} {{user `osm_installer`}}"
},
{
"type": "shell",
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
"script": "scripts/cleanup.sh"
}
],
"variables": {
"osm_installer": "https://osm-download.etsi.org/ftp/osm-4.0-four/install_osm.sh",
"input_ovf": "output-virtualbox-iso/packer-ubuntu-16.04-amd64-juju.ovf",
"vm_name": "packer-ubuntu-16.04-ovf-amd64"
},
"builders": [
{
"type": "virtualbox-ovf",
"source_path": "{{user `input_ovf`}}",
"headless": true,
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_port": 22,
"ssh_wait_timeout": "10000s",
"shutdown_command": "echo 'vagrant'|sudo -S shutdown -P now",
"virtualbox_version_file": ".vbox_version",
"vm_name": "{{user `vm_name`}}",
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--memory",
"4096"
],
[
"modifyvm",
"{{.Name}}",
"--cpus",
"2"
]
]
}
],
"post-processors": [
{
"output": "builds/{{.Provider}}-osm.box",
"type": "vagrant"
}
]
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment