forked from ruzickap/packer-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
my_centos-7.json
126 lines (123 loc) · 4.18 KB
/
my_centos-7.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
{
"_comment": "NAME=my_centos-7-x86_64 CENTOS_VERSION=7 CENTOS_TYPE=NetInstall CENTOS_TAG=1908 PACKER_IMAGES_OUTPUT_DIR=/var/tmp/ packer build -only=qemu my_centos-7.json",
"variables": {
"name": "{{ env `NAME` }}",
"packer_images_output_dir": "{{ env `PACKER_IMAGES_OUTPUT_DIR` }}",
"cpus": "2",
"memory": "4096",
"centos_type": "{{ env `CENTOS_TYPE` }}",
"centos_version": "{{ env `CENTOS_VERSION` }}",
"centos_tag": "{{ env `CENTOS_TAG` }}",
"centos_mirror": "http://ftp.cvut.cz/centos/",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"preseed_file_name": "my-ks.cfg",
"disk_size": "51200",
"headless": "false"
},
"builders":
[
{
"vm_name": "{{ user `name` }}",
"type": "qemu",
"iso_checksum_type": "sha256",
"iso_checksum_url": "{{ user `centos_mirror` }}{{ user `centos_version` }}/isos/x86_64/sha256sum.txt",
"iso_urls": [ "{{ user `centos_mirror` }}{{ user `centos_version` }}/isos/x86_64/CentOS-{{ user `centos_version` }}-x86_64-{{ user `centos_type` }}-{{ user `centos_tag` }}.iso" ],
"ssh_username": "{{ user `ssh_username` }}",
"ssh_password": "{{ user `ssh_password` }}",
"ssh_wait_timeout": "60m",
"accelerator": "kvm",
"headless": "{{ user `headless` }}",
"output_directory": "{{ user `name` }}-qemu",
"shutdown_command": "echo 'vagrant' | sudo -S shutdown -P now",
"accelerator": "kvm",
"qemuargs": [
[ "-m", "{{ user `memory` }}" ],
[ "-smp", "{{ user `cpus` }}" ]
],
"boot_wait": "5s",
"boot_command":
[
"<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos{{ user `centos_version` }}/my-ks.cfg<enter>"
],
"disk_size": "{{ user `disk_size` }}",
"http_directory": "http"
},
{
"vm_name": "{{ user `name` }}",
"type": "virtualbox-iso",
"guest_os_type": "RedHat_64",
"iso_checksum_type": "sha256",
"iso_checksum_url": "{{ user `centos_mirror` }}{{ user `centos_version` }}/isos/x86_64/sha256sum.txt",
"iso_urls": [ "{{ user `centos_mirror` }}{{ user `centos_version` }}/isos/x86_64/CentOS-{{ user `centos_version` }}-x86_64-{{ user `centos_type` }}-{{ user `centos_tag` }}.iso" ],
"ssh_username": "{{ user `ssh_username` }}",
"ssh_password": "{{ user `ssh_password` }}",
"ssh_wait_timeout": "60m",
"headless": "{{ user `headless` }}",
"output_directory": "{{ user `name` }}-virtualbox-iso",
"shutdown_command": "echo 'vagrant' | sudo -S shutdown -P now",
"hard_drive_interface": "sata",
"disk_size": "{{ user `disk_size` }}",
"vboxmanage": [
[
"modifyvm",
"{{ .Name }}",
"--cpus",
"{{ user `cpus` }}"
],
[
"modifyvm",
"{{ .Name }}",
"--memory",
"{{ user `memory` }}"
],
[
"modifyvm",
"{{ .Name }}",
"--audiocontroller",
"hda"
]
],
"boot_wait": "5s",
"boot_command":
[
"<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos{{ user `centos_version` }}/my-ks.cfg<enter>"
],
"http_directory": "http"
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "echo 'vagrant' | {{ .Vars }} sudo -S -E bash -x '{{ .Path }}'",
"scripts": [
"scripts/linux-common/vagrant.sh"
]
},
{
"type": "ansible",
"user": "vagrant",
"ansible_env_vars": [ "ANSIBLE_CONFIG=ansible/ansible.cfg" ],
"extra_arguments": [ "--become", "--extra-vars", "packer_build_name={{ user `name` }}" ],
"sftp_command": "/usr/libexec/openssh/sftp-server -e",
"playbook_file": "ansible/site.yml"
},
{
"type": "shell",
"execute_command": "echo 'vagrant' | {{ .Vars }} sudo -S -E bash -x '{{ .Path }}'",
"scripts": [
"scripts/linux-common/cleanup.sh"
]
}
],
"post-processors": [
[
{
"type": "vagrant",
"compression_level": 9,
"vagrantfile_template": "Vagrantfile-linux.template",
"output": "{{ user `packer_images_output_dir` }}/{{ user `name` }}-{{ .Provider }}.box"
}
]
]
}