95 lines
3.6 KiB
JSON
95 lines
3.6 KiB
JSON
{
|
|
"variables": {
|
|
"HTTPS_PROXY": "{{ env `HTTPS_PROXY` }}",
|
|
"HTTP_PROXY": "{{ env `HTTP_PROXY` }}",
|
|
"http_proxy": "{{ env `http_proxy` }}",
|
|
"https_proxy": "{{ env `https_proxy` }}",
|
|
"headless": "true",
|
|
"provisionning_dir": "{{ template_dir }}/../../../provisioning",
|
|
"alpine_provisionning": "{{ user `provisionning_dir`}}/alpine",
|
|
"root_password": "cadoles",
|
|
"al_flavour": "alpine-virt",
|
|
"al_mirror": "http://dl-cdn.alpinelinux.org/alpine",
|
|
"al_release": "3.12.0",
|
|
"al_version": "3.12",
|
|
"disk_size": "10240",
|
|
"vm_name": "alpine-312"
|
|
},
|
|
"builders": [
|
|
{
|
|
"accelerator": "kvm",
|
|
"boot_command": [
|
|
"<wait5s>root<enter>",
|
|
"<wait1s><enter>",
|
|
"<wait1s>passwd<enter><wait1s>cadoles<enter><wait1s>cadoles<enter>",
|
|
"<wait1s>setup-interfaces<enter><wait1s><enter><wait1s><enter><wait1s><enter>",
|
|
"<wait1s>ifup eth0<enter>",
|
|
"<wait1s>setup-sshd<enter>",
|
|
"<wait1s><enter><wait1s>",
|
|
"<wait1s>echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config<enter>",
|
|
"<wait1s>rc-service sshd stop<enter>",
|
|
"<wait1s>rc-service sshd start<enter>",
|
|
"<wait1s><enter>"
|
|
],
|
|
"boot_wait": "5s",
|
|
"disk_compression": false,
|
|
"disk_size": "{{user `disk_size`}}",
|
|
"format": "qcow2",
|
|
"headless": "{{user `headless`}}",
|
|
"http_directory": "{{ template_dir }}",
|
|
"iso_checksum": "file:{{ user `alpine_provisionning` }}/sums/{{ user `al_flavour` }}-{{ user `al_release` }}-x86_64.iso.sha256",
|
|
"iso_url": "{{ user `al_mirror` }}/v{{ user `al_version` }}/releases/x86_64/{{ user `al_flavour` }}-{{ user `al_release` }}-x86_64.iso",
|
|
"name": "{{ user `vm_name` }}",
|
|
"output_directory": "{{ template_dir }}/../../../images/alpine/{{user `al_version`}}/{{ user `al_flavour` }}",
|
|
"skip_compaction": true,
|
|
"ssh_password": "{{user `root_password`}}",
|
|
"ssh_timeout": "20m",
|
|
"ssh_username": "root",
|
|
"type": "qemu",
|
|
"vm_name": "{{ build_name }}-{{ isotime \"20060102\" }}.img"
|
|
}
|
|
],
|
|
"provisioners": [
|
|
{
|
|
"environment_vars": [
|
|
"VM_NAME={{user `vm_name`}}",
|
|
"HTTP_PROXY={{user `HTTP_PROXY`}}",
|
|
"HTTPS_PROXY={{user `HTTPS_PROXY`}}",
|
|
"http_proxy={{user `http_proxy`}}",
|
|
"https_proxy={{user `https_proxy`}}",
|
|
"ROOT_PASSWORD={{user `root_password`}}"
|
|
],
|
|
"expect_disconnect": true,
|
|
"script": "{{ user `alpine_provisionning` }}/setup-alpine.sh",
|
|
"type": "shell"
|
|
},
|
|
{
|
|
"environment_vars": [
|
|
"VM_NAME={{user `vm_name`}}",
|
|
"HTTP_PROXY={{user `HTTP_PROXY`}}",
|
|
"HTTPS_PROXY={{user `HTTPS_PROXY`}}",
|
|
"http_proxy={{user `http_proxy`}}",
|
|
"https_proxy={{user `https_proxy`}}",
|
|
"ROOT_PASSWORD={{user `root_password`}}"
|
|
],
|
|
"pause_before": "30s",
|
|
"scripts": [
|
|
"{{ user `alpine_provisionning` }}/configure-onecontext.sh",
|
|
"{{ user `alpine_provisionning` }}/finalize.sh"
|
|
],
|
|
"type": "shell"
|
|
}
|
|
],
|
|
"post-processors": [
|
|
{
|
|
"inline": [
|
|
"sleep 5",
|
|
"qemu-img convert -O qcow2 -c {{ template_dir }}/../../../images/alpine/{{ user `al_version` }}/{{ user `al_flavour` }}/{{ build_name }}-{{ isotime \"20060102\" }}.img {{ template_dir }}/../../../images/alpine/{{ user `al_version` }}/{{ user `al_flavour` }}/{{ user `al_flavour` }}-{{ user `al_version` }}.img",
|
|
"rm -rf {{ template_dir }}/../../../images/alpine/{{ user `al_version` }}/{{ user `al_flavour` }}/{{ build_name }}-{{ isotime \"20060102\" }}.img"
|
|
],
|
|
"type": "shell-local"
|
|
}
|
|
]
|
|
}
|
|
|