gns3-registry/packer/alpine-linux/alpine.json

77 lines
2.3 KiB
JSON

{
"variables": {
"iso_url": "https://dl-cdn.alpinelinux.org/alpine/v3.16/releases/x86_64/alpine-virt-3.16.3-x86_64.iso",
"iso_checksum": "file:https://dl-cdn.alpinelinux.org/alpine/v3.16/releases/x86_64/alpine-virt-3.16.3-x86_64.iso.sha256",
"ui_mode": "cli",
"vm_name": "alpine_cli.qcow2",
"file_source": "README.rst",
"setup_script": "setup.sh",
"disk_size": "500"
},
"builders": [
{
"type": "qemu",
"iso_url": "{{user `iso_url`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "sha256",
"shutdown_command": "poweroff",
"headless": true,
"ssh_username": "root",
"ssh_password": "root",
"vm_name": "{{user `vm_name`}}",
"disk_interface": "ide",
"disk_compression": true,
"net_device": "e1000",
"disk_size": "{{user `disk_size`}}",
"boot_wait": "20s",
"ssh_wait_timeout": "60s",
"boot_command": [
"root<enter><wait>",
"echo 'root:root' | chpasswd<enter>",
"ifconfig lo up<enter>",
"ifconfig eth0 up && udhcpc -i eth0<enter><wait10>",
"setup-sshd -c openssh<enter><wait>",
"sed -i.orig '$aPermitRootLogin yes' /etc/ssh/sshd_config<enter>",
"service sshd restart<enter><wait>"
]
}
],
"provisioners": [
{
"type": "shell",
"script": "scripts/install.sh"
},
{
"type": "shell",
"inline": [
"reboot"
]
},
{
"type": "shell",
"pause_before": "20s",
"inline": [
"apk upgrade --update-cache",
"mkdir -p /tmp/uploads"
]
},
{
"type": "shell",
"script": "scripts/{{user `ui_mode`}}.sh"
},
{
"type": "file",
"source": "files/{{user `file_source`}}",
"destination": "/tmp/uploads/"
},
{
"type": "shell",
"script": "scripts/{{user `setup_script`}}"
},
{
"type": "shell",
"script": "scripts/post_setup.sh"
}
]
}