101 lines
2.6 KiB
JSON
101 lines
2.6 KiB
JSON
{
|
|
"builders":
|
|
[
|
|
{
|
|
"type": "qemu",
|
|
"accelerator": "kvm",
|
|
"headless": true,
|
|
"qemuargs": [
|
|
["-boot", "b" ],
|
|
["-device", "virtio-rng-pci"]
|
|
],
|
|
"memory": "1024",
|
|
"cpus": "2",
|
|
"use_backing_file": "true",
|
|
"format": "qcow2",
|
|
"net_device": "virtio-net",
|
|
|
|
"disk_interface": "virtio",
|
|
"disk_size": "80g",
|
|
"disk_image": "true",
|
|
"disk_compression": "true",
|
|
"disk_additional_size": [],
|
|
|
|
"iso_urls": [
|
|
"/packer/install-amd64-minimal-{{user `version`}}.iso",
|
|
"http://distfiles.gentoo.org/releases/amd64/autobuilds/{{user `version`}}/install-amd64-minimal-{{user `version`}}.iso"
|
|
],
|
|
"iso_checksum_url": "http://distfiles.gentoo.org/releases/amd64/autobuilds/{{user `version`}}/install-amd64-minimal-{{user `version`}}.iso.DIGESTS.asc",
|
|
"iso_checksum_type": "file",
|
|
|
|
"vm_name": "gentoo_packer.qcow2",
|
|
"output_directory": "output_gentoo_qcow2",
|
|
|
|
"http_directory": "/packer/httpdir",
|
|
"http_port_min": 10082,
|
|
"http_port_max": 10082,
|
|
|
|
"ssh_host_port_min": 2229,
|
|
"ssh_host_port_max": 2229,
|
|
|
|
"ssh_host": "127.0.0.1",
|
|
"ssh_port": "22",
|
|
"ssh_username": "{{user `ssh_username`}}",
|
|
"ssh_password": "{{user `ssh_password`}}",
|
|
|
|
"ssh_wait_timeout": "900m",
|
|
|
|
"vnc_port_min": "5900",
|
|
"vnc_port_max": "5900",
|
|
|
|
"boot_wait": "3s",
|
|
"boot_command":
|
|
[
|
|
"gentoo-nofb",
|
|
"<enter>",
|
|
"<wait5>",
|
|
"<enter>",
|
|
"<wait15s>",
|
|
"passwd {{user `ssh_username`}}",
|
|
"<enter>",
|
|
"<wait>",
|
|
"{{user `ssh_password`}}",
|
|
"<enter>",
|
|
"<wait>",
|
|
"{{user `ssh_password`}}",
|
|
"<enter>",
|
|
"<wait>",
|
|
"sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config",
|
|
"<enter>",
|
|
"<wait>",
|
|
"echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config",
|
|
"<enter>",
|
|
"<wait>",
|
|
"/etc/init.d/sshd start",
|
|
"<enter>",
|
|
"<wait>"
|
|
],
|
|
|
|
"shutdown_command": "shutdown -P now"
|
|
}
|
|
],
|
|
"provisioners":
|
|
[
|
|
{
|
|
"type": "ansible",
|
|
"playbook_file": "/packer/ansible/playbook.yml",
|
|
"extra_arguments": [ "--extra-vars", "ssh_pub={{user `ssh_pub_key`}} generated_user={{user `generated_user`}} generated_group={{user `generated_group`}}" ],
|
|
"groups": "default",
|
|
"user": "root"
|
|
}
|
|
],
|
|
"variables": {
|
|
"ssh_username": "root",
|
|
"ssh_password": "CHANGEME",
|
|
"ssh_pub_key": "",
|
|
"generated_user": "antoine",
|
|
"generated_group": "antoine",
|
|
"version": "20200205T214502Z"
|
|
}
|
|
}
|