-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpacker.json
127 lines (126 loc) · 4.91 KB
/
packer.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
{
"builders": [
{
"boot_command": [
"<tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><wait>",
"<tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><wait>",
"<tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><wait>",
"<tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><wait>",
"<tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><wait>",
"<tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><wait>",
"<tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><wait>",
"<tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><wait>",
"<tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><wait>",
"<tab><tab><tab><tab><tab><tab><tab><tab><tab><tab><wait>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"vmlinuz initrd=initrd.img inst.stage2=cdrom quite text <wait5>",
"net.ifnames=0 biosdevname=0 systemd.unified_cgroup_hierarchy=0 <wait5>",
"inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/ks.cfg <wait5>",
"<enter>"
],
"boot_wait": "1s",
"cpus": 2,
"disk_size": 131072,
"gfx_accelerate_3d": false,
"gfx_controller": "vboxsvga",
"guest_additions_mode": "upload",
"guest_os_type": "RedHat_64",
"headless": true,
"http_directory": "./",
"iso_checksum": "e33d7b1ea7a9e2f38c8f693215dd85254c3a4fe446f93f563279715b68d07987",
"iso_url": "http://vault.centos.org/centos/7.9.2009/isos/x86_64/CentOS-7-x86_64-DVD-2009.iso",
"memory": 16384,
"shutdown_command": "sudo shutdown -h now",
"ssh_password": "vagrant",
"ssh_port": 22,
"ssh_read_write_timeout": "600s",
"ssh_timeout": "120m",
"ssh_username": "vagrant",
"type": "virtualbox-iso",
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--cpu-profile",
"host"
],
[
"modifyvm",
"{{.Name}}",
"--nested-hw-virt",
"on"
],
[
"modifyvm",
"{{.Name}}",
"--nat-localhostreachable1",
"on"
]
],
"vrdp_bind_address": "0.0.0.0",
"vrdp_port_max": 6000,
"vrdp_port_min": 5900
}
],
"post-processors": [
{
"inline": [
"set -eu",
"export _IMAGE=\"$(ls -1d output-virtualbox-iso/packer-virtualbox-iso-*.vmdk)\"",
"sudo qemu-img convert -f vmdk -O qcow2 \"$_IMAGE\" \"$_IMAGE.convert\"",
"sudo rm -rf \"$_IMAGE\"",
"sudo chmod a+r /boot/vmlinuz*",
"sudo virt-customize --no-network -a \"$_IMAGE.convert\" --delete \"/var/lib/*/random-seed\" --delete \"/var/lib/wicked/*\" --firstboot-command \"/usr/local/bin/virt-sysprep-firstboot.sh\"",
"sudo virt-sysprep --operations defaults,-ssh-userdir,-customize -a \"$_IMAGE.convert\"",
"sudo virt-sparsify --in-place \"$_IMAGE.convert\"",
"sudo qemu-img convert -f qcow2 -O vmdk \"$_IMAGE.convert\" \"$_IMAGE\"",
"sudo rm -rf \"$_IMAGE.convert\""
],
"type": "shell-local"
},
{
"compression_level": 9,
"keep_input_artifact": true,
"output": "output-vagrant/package.box",
"provider_override": "virtualbox",
"type": "vagrant"
}
],
"provisioners": [
{
"inline": [
"set -eu",
"sudo sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/*.repo",
"sudo sed -i 's?dl.fedoraproject.org/pub/epel?archives.fedoraproject.org/pub/archive/epel?g' /etc/yum.repos.d/*.repo",
"sudo sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/*.repo",
"sudo sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/*.repo",
"sudo sed -i 's/enabled=1/enabled=0/g' /etc/yum/pluginconf.d/fastestmirror.conf || true",
"sudo yum makecache",
"sudo yum update -y",
"sudo yum install -y ca-certificates curl gcc glibc-common gnupg2 hostname iproute python3 sudo yum-utils",
"sudo yum install -y http://archives.fedoraproject.org/pub/archive/epel/7/x86_64/Packages/d/dkms-3.0.12-1.el7.noarch.rpm",
"sudo yum install -y bzip2 dkms kernel-devel",
"sudo mount -o loop VBoxGuestAdditions.iso /mnt",
"(echo 'y' | sudo sh /mnt/VBoxLinuxAdditions.run) || echo $?",
"sudo umount /mnt"
],
"type": "shell"
},
{
"galaxy_file": "./ansible-galaxy-requirements.yml",
"inventory_directory": "./",
"playbook_file": "./packer.yml",
"type": "ansible",
"user": "vagrant"
}
]
}