-
Notifications
You must be signed in to change notification settings - Fork 6
/
template.json
64 lines (64 loc) · 2.57 KB
/
template.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
{
"min_packer_version": "0.8.6",
"description": "Bare CentOS 7 prepped for AMI import",
"variables": {
"profile": "xfs",
"disk_size": "8192",
"memory": "6122",
"cpus": "4",
"ssh_username": "centos",
"ssh_password": "centos"
},
"builders": [
{
"type": "virtualbox-iso",
"vm_name": "centos7-ec2-{{user `profile`}}",
"headless": true,
"guest_os_type": "RedHat_64",
"disk_size": "{{user `disk_size`}}",
"vboxmanage": [
["modifyvm", "{{.Name}}", "--memory", "{{user `memory`}}"],
["modifyvm", "{{.Name}}", "--cpus", "{{user `cpus`}}"]
],
"iso_url": "http://mirror.steadfast.net/centos/7/isos/x86_64/CentOS-7-x86_64-NetInstall-1511.iso",
"iso_checksum": "9ed9ffb5d89ab8cca834afce354daa70a21dcb410f58287d6316259ff89758f5",
"iso_checksum_type": "sha256",
"http_directory": "http",
"boot_command": ["<tab> text ks=http://{{.HTTPIP}}:{{.HTTPPort}}/ks-{{user `profile`}}.cfg<enter><wait>"],
"boot_wait": "10s",
"ssh_username": "{{user `ssh_username`}}",
"ssh_password": "{{user `ssh_password`}}",
"ssh_port": 22,
"ssh_wait_timeout": "10000s",
"guest_additions_mode": "disable",
"shutdown_command": "sudo -S shutdown -P now",
"output_directory": "output-{{user `profile`}}",
"format": "ova"
}
],
"provisioners": [
{
"type": "file",
"source": "10-growpart.cfg",
"destination": "/tmp/10-growpart.cfg"
},
{
"type": "shell",
"execute_command": "sudo -S sh '{{.Path}}'",
"inline": [
"yum -y install cloud-init cloud-utils cloud-utils-growpart",
"mv /tmp/10-growpart.cfg /etc/cloud/cloud.cfg.d/10-growpart.cfg",
"chown root:root /etc/cloud/cloud.cfg.d/10-growpart.cfg",
"systemctl enable cloud-config.service",
"systemctl enable cloud-final.service",
"systemctl enable cloud-init-local.service",
"systemctl enable cloud-init.service",
"echo \"{{user `ssh_username`}}:$(openssl rand -base64 32)\" | chpasswd",
"shred -u /etc/ssh/*_key /etc/ssh/*_key.pub",
"shred -u /root/.*history /home/centos/.*history",
"dd if=/dev/zero of=/zeros bs=1M",
"rm -f /zeros"
]
}
]
}