"_comment": "This file managed by salt. Local changes will be overwritten.",
"builders": [
{
"vm_name": "{{user `vmname`}}",
"type": "virtualbox-iso",
"headless": true,
"vrdp_bind_address": "0.0.0.0",
"guest_os_type": "Ubuntu_64",
"iso_url": "http://{{user `webserver`}}/{{user `os_file`}}.iso",
"iso_checksum_url": "{{user `iso_checksum`}}",
"iso_checksum_type": "file",
"ssh_username": "packer",
"ssh_password": "packer",
"ssh_wait_timeout": "15m",
"shutdown_command": "echo 'packer' | sudo -S shutdown -P now",
"disk_size": "30000",
"hard_drive_interface": "sata",
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--boot1",
"dvd"
],
[
"modifyvm",
"{{.Name}}",
"--boot2",
"disk"
],
[
"modifyvm",
"{{.Name}}",
"--nictype1",
"virtio"
],
[
"modifyvm",
"{{.Name}}",
"--memory",
"2048"
],
[
"modifyvm",
"{{.Name}}",
"--cpus",
"4"
],
[
"modifyvm",
"{{.Name}}",
"--audio",
"none"
],
[
"modifyvm",
"{{.Name}}",
"--usb",
"off"
]
],
"boot_command": [
"<esc><esc><enter><wait>",
"/install/vmlinuz noapic ",
"preseed/url=http://{{user `webserver`}}/{{user `os_file`}}.cfg ",
"debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
"hostname={{user `vmname`}} ",
"fb=false debconf/frontend=noninteractive ",
"keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
"keyboard-configuration/variant=USA console-setup/ask_detect=false ",
"DEBCONF=debug ",
"initrd=/install/initrd.gz -- <enter>"
],
"output_directory": "vbox/"
},
{
"type": "amazon-ebs",
"access_key": "{{ user `access_key` }}",
"secret_key": "{{ user `secret_key` }}",
"ami_users": [
"<snip>",
"<snip>"
],
"region": "us-east-1",
"source_ami_filter": {
"filters": {
"name": "ubuntu/images/hvm-ssd/*ubuntu-bionic-18.04-amd64-server-*",
"root-device-type": "ebs"
},
"owners": ["099720109477"],
"most_recent": true
},
"vpc_id": "vpc-04ee3040de35bc755",
"subnet_id": "subnet-05b0e1ad8679eb394",
"instance_type": "t3.micro",
"ssh_username": "ubuntu",
"ami_name": "{{user `vmname`}}-{{user `salt_environment`}}-{{ user `commit` }}",
"spot_price": "0.0104",
"run_tags": {
"application": "packer"
}
}
],
"provisioners": [
{
"type": "file",
"source": "upload/",
"destination": "/tmp"
},
{
"type": "shell",
"inline": [
"/usr/bin/cloud-init status --wait"
],
"only": ["amazon-ebs"]
},
{
"type": "shell",
"scripts": [
"/etc/vmimage/init.sh"
],
"environment_vars": [
"SALT_ENVIRONMENT={{user `salt_environment`}}",
"SALT_VERSION={{user `salt_version`}}",
"SLS_STATES={{user `sls_states`}}"
]
},
{
"type": "shell",
"inline": [
"sudo mount /home/packer/VBoxGuestAdditions.iso /mnt",
"sudo sh /mnt/VBoxLinuxAdditions.run || true",
"sudo umount /mnt",
"sudo dmidecode -s system-product-name > /home/packer/vmtype"
],
"only": ["virtualbox-iso"]
},
{
"type": "shell",
"inline": [
"sudo sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config",
"sudo cat /etc/ssh/sshd_config"
],
"only": ["virtualbox-iso"]
}
],
"post-processors": [
{
"type": "vagrant",
"output": "plos_{{.Provider}}_{{user `commit`}}_{{isotime \"2006-01-02-150405\"}}.box",
"keep_input_artifact": true,
"only": ["virtualbox-iso"]
}
]
}