This repository has been archived by the owner on Sep 1, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
packer-debian8-qemu-kvm.json
95 lines (93 loc) · 3.35 KB
/
packer-debian8-qemu-kvm.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
92
93
94
95
{
"variables": {
"ansible_roles_path": "./ansible/roles",
"build_id": "{{isotime \"20060102150405\"}}",
"build_name": "packer-debian8-qemu-kvm",
"disk_size": "10240",
"iso_checksum": "28641eb3f657a71fccc1506b2953b4f3130937cdcff686162a882bc045ad32482ec4b5eb3d2d711d59cdd610e338579776e96a11895d51bbe88e831fa3d8a7af",
"iso_checksum_type": "sha512",
"iso_name": "debian-8.11.0-amd64-netinst.iso",
"local_domain": "lan.mydomain.com",
"local_mirror_url": "http://localhost",
"output_dir": "output",
"remote_mirror_url": "https://cdimage.debian.org/mirror/cdimage/archive/8.11.0/amd64/iso-cd"
},
"builders": [
{
"accelerator": "kvm",
"boot_command": [
"<esc><wait>",
"auto <wait>",
"console-keymaps-at/keymap=us <wait>",
"console-setup/ask_detect=false <wait>",
"debconf/frontend=noninteractive <wait>",
"debian-installer=en_US <wait>",
"fb=false <wait>",
"install <wait>",
"kbd-chooser/method=us <wait>",
"keyboard-configuration/xkb-keymap=us <wait>",
"locale=en_US <wait>",
"netcfg/get_domain={{ user `local_domain` }} <wait>",
"netcfg/get_hostname={{ .Name }} <wait>",
"preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg <wait>",
"<enter><wait>"
],
"boot_wait": "5s",
"disk_size": "{{ user `disk_size` }}",
"format": "qcow2",
"headless": true,
"http_directory": "http",
"iso_checksum": "{{ user `iso_checksum` }}",
"iso_checksum_type": "{{ user `iso_checksum_type` }}",
"iso_urls": [
"{{ user `local_mirror_url` }}/{{ user `iso_name` }}",
"{{ user `remote_mirror_url` }}/{{ user `iso_name` }}"
],
"output_directory": "{{ user `output_dir` }}/{{ user `build_name` }}-qemu-{{ user `build_id` }}",
"qemuargs": [
[ "-m", "1024M" ]
],
"shutdown_command": "sudo /sbin/halt -h -p",
"ssh_password": "root",
"ssh_port": 22,
"ssh_username": "root",
"ssh_wait_timeout": "1800s",
"type": "qemu",
"vm_name": "{{ user `build_name` }}-{{ user `build_id` }}"
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "{{.Vars}} bash '{{.Path}}'",
"inline": [
"sleep 30",
"apt-get -y update",
"DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\" dist-upgrade",
"apt-get -y install build-essential python-dev python-pip libffi-dev libssl-dev libxml2-dev libxslt1-dev zlib1g-dev",
"apt-get -y --purge remove python-cffi",
"pip install ansible==2.2.0"
]
},
{
"type": "ansible-local",
"playbook_dir": "ansible",
"playbook_file": "ansible/playbook.yml",
"role_paths": [
"{{ user `ansible_roles_path` }}/apt-sources",
"{{ user `ansible_roles_path` }}/serial-console"
]
},
{
"type": "shell",
"execute_command": "{{.Vars}} bash '{{.Path}}'",
"inline": [
"pip uninstall -y ansible httplib2 Jinja2 paramiko PyYAML six",
"apt-get -y purge python-dev python-pip libffi-dev libssl-dev libxml2-dev libxslt1-dev zlib1g-dev",
"apt-get -y autoremove --purge",
"apt-get -y clean",
"rm -rf /tmp ; mkdir /tmp ; chmod 1777 /tmp"
]
}
]
}