forked from goffinet/packer-kvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bionic.json
91 lines (91 loc) · 3.14 KB
/
bionic.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
{
"variables":
{
"cpu": "2",
"ram": "2048",
"name": "bionic",
"disk_size": "40000",
"version": "",
"iso_checksum_type": "sha256",
"iso_urls": "http://archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/current/images/netboot/mini.iso",
"iso_checksum": "bed8a55ae2a657f8349fe3271097cff3a5b8c3d1048cf258568f1601976fa30d",
"headless": "true",
"config_file": "ubuntu1804-preseed.cfg",
"ssh_username": "root",
"ssh_password": "testtest",
"destination_server": "download.goffinet.org"
},
"builders": [
{
"name": "{{user `name`}}{{user `version`}}",
"type": "qemu",
"format": "qcow2",
"accelerator": "kvm",
"qemu_binary": "/usr/bin/qemu-system-x86_64",
"net_device": "virtio-net",
"disk_interface": "virtio",
"disk_cache": "none",
"qemuargs": [[ "-m", "{{user `ram`}}M" ],[ "-smp", "{{user `cpu`}}" ]],
"ssh_wait_timeout": "45m",
"http_directory": ".",
"http_port_min": 10082,
"http_port_max": 10089,
"host_port_min": 2222,
"host_port_max": 2229,
"ssh_username": "{{user `ssh_username`}}",
"ssh_password": "{{user `ssh_password`}}",
"iso_urls": "{{user `iso_urls`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"boot_wait": "15s",
"boot_command": [
"<tab><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"net.ifnames=0 biosdevname=0 fb=false hostname={{user `name`}}{{user `version`}} locale=en_US ",
"console-keymaps-at/keymap=us console-setup/ask_detect=false ",
"console-setup/layoutcode=us keyboard-configuration/layout=USA keyboard-configuration/variant=USA ",
"preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/http/{{user `config_file`}} <enter><wait>"
],
"disk_size": "{{user `disk_size`}}",
"disk_discard": "unmap",
"disk_compression": true,
"headless": "{{user `headless`}}",
"shutdown_command": "echo '{{user `ssh_password`}}' | sudo -S shutdown -P now",
"output_directory": "artifacts/qemu/{{user `name`}}{{user `version`}}"
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "{{ .Vars }} sudo -E bash '{{ .Path }}'",
"inline": [
"sudo apt-get update",
"sudo apt-get -y install software-properties-common",
"sudo apt-add-repository --yes --update ppa:ansible/ansible",
"sudo apt update",
"sudo apt -y install ansible"
]
},
{
"type": "ansible-local",
"playbook_file": "ansible/playbook.yml",
"playbook_dir": "ansible"
},
{
"type": "shell",
"execute_command": "{{ .Vars }} sudo -E bash '{{ .Path }}'",
"inline": [
"sudo apt -y remove ansible",
"sudo apt-get clean",
"sudo apt-get -y autoremove --purge"
]
}
],
"post-processors": [
{
"type": "shell-local",
"script": "scripts/push-image.sh",
"environment_vars": ["IMAGE_NAME={{user `name`}}",
"IMAGE_VERSION={{user `version`}}",
"DESTINATION_SERVER={{user `destination_server`}}"]
}
]
}