This repository has been archived by the owner on Jul 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
CentOS-7-Minimal-AMI-libvirt.json
174 lines (174 loc) · 7.01 KB
/
CentOS-7-Minimal-AMI-libvirt.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
{
"variables": {
"build_accelerator": "kvm",
"build_export_format": "qcow2",
"build_iso_checksum": "07b94e6b1a0b0260b94c83d6bb76b26bf7a310dc78d7a9c7432809fb9bc6194a",
"build_iso_checksum_type": "sha256",
"build_iso_filename": "CentOS-7-x86_64-Minimal-2009.iso",
"build_iso_target_path": "isos/x86_64",
"build_name": "CentOS-7.9.2009-x86_64-Minimal-AMI-en_US",
"build_output_directory": "builds",
"build_output_format": "vmdk",
"guest_boot_timeout": "0",
"guest_bootloader_append": "net.ifnames=0 biosdevname=0",
"guest_cpus": "1",
"guest_firewall_disabled": "false",
"guest_hard_disk_size": "4096",
"guest_keyboard": "us",
"guest_language": "en_US.UTF-8",
"guest_lv_root_fstype": "ext4",
"guest_lv_root_mkfsoptions": "-i 4096",
"guest_lv_root_size": "1024",
"guest_lv_swap_size": "0",
"guest_name": "CentOS-7.9.2009-x86_64-Minimal-AMI-en_US",
"guest_partition_boot_fstype": "ext4",
"guest_partition_boot_size": "1024",
"guest_memory": "1024",
"guest_selinux": "permissive",
"guest_timezone": "Etc/UTC",
"guest_vram": "16",
"guest_vg_root_reserved_space": "0",
"ssh_root_password": "centos",
"ssh_user": "centos",
"ssh_user_authorized_keys": "",
"ssh_user_home": "/home/centos",
"ssh_user_password": "centos",
"ssh_user_shell": "/bin/bash",
"ssh_user_sudo": "ALL=(ALL) NOPASSWD:ALL"
},
"builders": [
{
"type": "qemu",
"name": "{{user `build_name`}}",
"accelerator": "{{user `build_accelerator`}}",
"boot_command": [
"<esc><wait>",
"linux ks=http://{{.HTTPIP}}:{{.HTTPPort}}/centos-7-minimal.cfg",
" BOOT_TIMEOUT={{user `guest_boot_timeout`}}",
" BOOTLOADER_APPEND=\"{{user `guest_bootloader_append`}}\"",
" BOOTLOADER_THEME=details",
" LANG={{user `guest_language`}}",
" KEYTABLE={{user `guest_keyboard`}}",
" TIMEZONE={{user `guest_timezone`}}",
" ROOTPW={{user `ssh_root_password`}}",
" FIREWALL_DISABLED={{user `guest_firewall_disabled`}}",
" SELINUX={{user `guest_selinux`}}",
" LV_ROOT_FSTYPE={{user `guest_lv_root_fstype`}}",
" LV_ROOT_MKFSOPTIONS=\"{{user `guest_lv_root_mkfsoptions`}}\"",
" LV_ROOT_SIZE={{user `guest_lv_root_size`}}",
" LV_SWAP_SIZE={{user `guest_lv_swap_size`}}",
" PART_BOOT_FSTYPE={{user `guest_partition_boot_fstype`}}",
" PART_BOOT_SIZE={{user `guest_partition_boot_size`}}",
" VG_ROOT_RESERVED_SPACE={{user `guest_vg_root_reserved_space`}}",
"<enter><wait>"
],
"boot_key_interval": "10ms",
"boot_wait": "3s",
"disk_interface": "virtio-scsi",
"disk_discard": "unmap",
"disk_detect_zeroes": "on",
"disk_cache": "unsafe",
"disk_image": false,
"disk_compression": true,
"disk_size": "{{user `guest_hard_disk_size`}}",
"format": "{{user `build_export_format`}}",
"headless": true,
"http_directory": "http",
"iso_checksum": "{{user `build_iso_checksum`}}",
"iso_target_path": "{{user `build_iso_target_path`}}",
"iso_url": "{{user `build_iso_target_path`}}/{{user `build_iso_filename`}}",
"machine_type": "q35",
"memory": "{{user `guest_memory`}}",
"net_device": "virtio-net",
"qemuargs": [
[ "-global", "virtio-pci.disable-modern=on" ],
[ "-cpu", "host" ]
],
"ssh_username": "root",
"ssh_password": "{{user `ssh_root_password`}}",
"ssh_port": 22,
"ssh_wait_timeout": "10m",
"shutdown_command": "/sbin/shutdown --no-wall -P now",
"shutdown_timeout": "1m",
"vm_name": "{{user `guest_name`}}"
}
],
"post-processors": [
{
"type": "compress",
"output": "{{user `build_output_directory`}}/{{.BuildName}}.{{user `build_export_format`}}.tar.gz",
"compression_level": 9,
"keep_input_artifact": true
},
{
"type": "shell-local",
"execute_command": "chmod +x \"{{.Script}}\"; {{.Vars}} /bin/bash \"{{.Script}}\" {{user `build_output_directory`}} {{user `build_export_format`}} {{user `build_output_format`}}",
"inline_shebang": "/bin/bash -e",
"inline": [
"if [[ -n ${1} ]] && [[ -n ${2} ]] && [[ -n ${PACKER_BUILD_NAME} ]] && [[ -d output-${PACKER_BUILD_NAME} ]]",
"then",
" echo '--> Moving build artifact.'",
" mv -f output-${PACKER_BUILD_NAME}/${PACKER_BUILD_NAME} ${1}/${PACKER_BUILD_NAME}.${2}",
" printf -- '--> Convert build artifact from %s to %s.\n' ${2} ${3}",
" if [[ ${3} == vmdk ]]",
" then",
" qemu-img convert -f ${2} -O ${3} -o subformat=streamOptimized,compat6 ${1}/${PACKER_BUILD_NAME}.${2} ${1}/${PACKER_BUILD_NAME}.${3}",
" else",
" qemu-img convert -f ${2} -O ${3} ${1}/${PACKER_BUILD_NAME}.${2} ${1}/${PACKER_BUILD_NAME}.${3}",
" fi",
"fi",
"echo '--> Cleanup output directories.'",
"find . -mindepth 1 -maxdepth 1 -type d -name \"output-*\" -exec rm -rf '{}' +"
]
}
],
"provisioners": [
{
"type": "file",
"source": "src/etc/systemd/system/grow-root.service",
"destination": "/etc/systemd/system/grow-root.service"
},
{
"type": "shell",
"execute_command": "chmod +x \"{{.Path}}\"; env {{.Vars}} /bin/bash \"{{.Path}}\"",
"remote_folder": "/var/tmp",
"skip_clean": false,
"environment_vars": [
"GUEST_LANG={{user `guest_language`}}",
"SSH_USER={{user `ssh_user`}}",
"SSH_USER_AUTHORIZED_KEYS={{user `ssh_user_authorized_keys`}}",
"SSH_USER_HOME={{user `ssh_user_home`}}",
"SSH_USER_PASSWORD={{user `ssh_user_password`}}",
"SSH_USER_SHELL={{user `ssh_user_shell`}}",
"SSH_USER_SUDO={{user `ssh_user_sudo`}}"
],
"scripts": [
"scripts/install/nfs-utils.sh",
"scripts/install/tuned-virtual-guest.sh",
"scripts/install/cloud-init.sh",
"scripts/install/cloud-utils-growpart.sh",
"scripts/install/systemd-unit-file-grow-root.sh",
"scripts/cloud-init/disable-locale-module.sh",
"scripts/cloud-init/add-datasource-list-aws.sh",
"scripts/cloud-init/add-logging-output.sh",
"scripts/cloud-init/add-preserve-hostname.sh",
"scripts/common/ifcfg-name-to-device.sh",
"scripts/common/sshd-config-non-root-key-auth.sh",
"scripts/common/sudoers-default-not-requiretty.sh",
"scripts/common/ssh-user.sh",
"scripts/common/seal-virtual-guest.sh",
"scripts/common/locale-trim-definitions.sh",
"scripts/common/locale-trim-translations.sh",
"scripts/common/locale-lock-sysconfig.sh",
"scripts/common/purge-documentation.sh",
"scripts/common/purge-desktop-graphics.sh",
"scripts/common/purge-temporary-directories.sh",
"scripts/common/yum-cleanup.sh",
"scripts/common/rpm-rebuild-db.sh",
"scripts/common/stop-and-truncate-logs.sh",
"scripts/common/zero-out-disks.sh",
"scripts/common/lock-root-user.sh"
]
}
]
}