fabrica/.packer/recipes/eole/2.7.2/eolebase.json

86 lines
3.1 KiB
JSON

{
"variables": {
"HTTP_PROXY": "{{ env `HTTP_PROXY` }}",
"HTTPS_PROXY": "{{ env `HTTPS_PROXY` }}",
"http_proxy": "{{ env `http_proxy` }}",
"https_proxy": "{{ env `https_proxy` }}",
"provisionning_dir": "{{ template_dir }}/../../../provisioning",
"eole_provisionning": "{{ user `provisionning_dir`}}/eole",
"eole_playbooks": "{{ user `provisionning_dir` }}/playbooks/eole",
"module_name": "eolebase",
"ubuntu_version": "18.04",
"eole_version": "2.7.2",
"vm_name": "eolebase-2.7.2",
"image_size": "10240",
"output_dir": "{{ template_dir }}/../../../images/eole/2.7.2/{{ user `module_name` }}",
"image_name": "{{ user `vm_name` }}-{{ isotime \"20060102\" }}"
},
"builders": [
{
"name": "{{ user `vm_name` }}",
"type": "qemu",
"iso_url": "{{ template_dir }}/../../../images/ubuntu/{{user `ubuntu_version`}}/ubuntu-{{ user `ubuntu_version` }}.img",
"iso_checksum": "none",
"disk_image": true,
"format": "qcow2",
"disk_size": "{{ user `image_size` }}",
"ssh_username": "root",
"ssh_password": "cadoles",
"http_directory": "{{ template_dir }}",
"accelerator": "kvm",
"net_device": "virtio-net",
"disk_interface": "virtio",
"ssh_wait_timeout": "45m",
"boot_wait": "5s",
"output_directory": "{{ user `output_dir` }}",
"vm_name": "{{ user `image_name` }}.img",
"headless": true,
"cpus": "2",
"memory" : "4096"
}
],
"provisioners": [
{
"type": "file",
"source": "{{ user `eole_provisionning` }}/onecontext/net-99-eole",
"destination": "/root/net-99-eole"
},
{
"type": "file",
"source": "{{ user `eole_provisionning` }}/{{ user `eole_version` }}/modif/00-eole.yaml",
"destination": "/root/00-eole.yaml"
},
{
"type": "file",
"source": "{{ user `eole_provisionning` }}/{{ user `eole_version` }}/netplan/01-netcfg.yaml",
"destination": "/etc/netplan/01-netcfg.yaml"
},
{
"type":"file",
"source":"{{user `provisionning_dir` }}/ssl",
"destination":"/usr/local/share/ca-certificates/rapidssl"
},
{
"type": "ansible",
"playbook_file": "{{user `eole_playbooks`}}/eole.yml",
"extra_arguments": [ "-vvvv", "--extra-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` }}"]
},
{
"type":"ansible",
"playbook_file":"{{ user `eole_playbooks` }}/provision.yml",
"extra_arguments": [ "--extra-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` }}"]
}
],
"post-processors": [
{
"type": "shell-local",
"inline": [
"sleep 5",
"qemu-img convert -O qcow2 -c {{ user `output_dir` }}/{{ user `image_name` }}.img {{ user `output_dir` }}/{{ user `vm_name` }}.img",
"rm -rf {{ user `output_dir` }}/{{ user `image_name` }}.img"
]
}
]
}