-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.pkr.hcl
More file actions
47 lines (41 loc) · 1.55 KB
/
build.pkr.hcl
File metadata and controls
47 lines (41 loc) · 1.55 KB
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
build {
sources = [
"source.amazon-ebs.arm64",
"source.amazon-ebs.x86_64",
]
# The following provisioner was added to avoid sporadic aptitude install failures
# at build time. See issue #12 for details.
provisioner "shell" {
inline = ["sudo apt-get update"]
}
provisioner "ansible" {
galaxy_file = "ansible/requirements.yml"
galaxy_force_install = var.force_install_ansible_requirements
galaxy_force_with_deps = var.force_install_ansible_requirements_with_dependencies
playbook_file = "ansible/upgrade.yml"
use_proxy = false
use_sftp = true
}
provisioner "ansible" {
playbook_file = "ansible/python.yml"
use_proxy = false
use_sftp = true
}
provisioner "ansible" {
ansible_env_vars = ["AWS_DEFAULT_REGION=${var.build_region}"]
playbook_file = "ansible/playbook.yml"
use_proxy = false
use_sftp = true
}
provisioner "shell" {
execute_command = "chmod +x {{ .Path }}; sudo env {{ .Vars }} bash {{ .Path }} ; rm -f {{ .Path }}"
script = "post_setup.sh"
skip_clean = true
}
provisioner "shell" {
# We need to call bash here because /tmp has the noexec bit on it
execute_command = "chmod +x {{ .Path }}; sudo env {{ .Vars }} bash {{ .Path }} ; rm -f {{ .Path }}"
inline = ["sed --in-place '/^users:/ {N; s/users:.*/users: []/g}' /etc/cloud/cloud.cfg", "rm --force /etc/sudoers.d/90-cloud-init-users", "rm --force /root/.ssh/authorized_keys"]
skip_clean = true
}
}