-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.vmx-update.pkr.hcl
44 lines (40 loc) · 1.75 KB
/
build.vmx-update.pkr.hcl
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
build {
sources = ["source.vmware-vmx.update"]
provisioner "shell" {
# Note: sudo -S env is necessary ot pass the environment variables down to each script
execute_command = "echo '${var.password}' | sudo -S env {{ .Vars }} {{ .Path }}"
environment_vars = local.script_environment_variables
scripts = [
"${path.root}/builtin_scripts/ubuntu/disable-aptdaily.sh",
"${path.root}/builtin_scripts/ubuntu/system-update.sh",
]
}
provisioner "shell" {
execute_command = "echo '${var.password}' | sudo -S -E bash '{{ .Path }}'"
scripts = [
"${path.root}/custom_scripts/cast-install.sh",
"${path.root}/custom_scripts/cast-sift.sh",
"${path.root}/custom_scripts/cast-clean.sh",
]
}
# Stage X - Sysprep Scripts (Part 2)
# Final Scripts, the last scripts that should be run.
provisioner "shell" {
execute_command = "echo '${var.password}' | sudo -S -E bash '{{ .Path }}'"
scripts = [
"${path.root}/builtin_scripts/virt-sysprep/sysprep-op-dhcp-client-state.sh",
"${path.root}/builtin_scripts/virt-sysprep/sysprep-op-logfiles.sh",
"${path.root}/builtin_scripts/virt-sysprep/sysprep-op-machine-id.sh",
"${path.root}/builtin_scripts/virt-sysprep/sysprep-op-network.sh",
"${path.root}/builtin_scripts/virt-sysprep/sysprep-op-package-manager-cache.sh",
"${path.root}/builtin_scripts/virt-sysprep/sysprep-op-ssh-hostkeys.sh",
"${path.root}/builtin_scripts/virt-sysprep/sysprep-op-tmp-files.sh",
"${path.root}/builtin_scripts/virt-sysprep/sysprep-op-disk-space.sh",
]
}
post-processors {
post-processor "shell-local" {
inline = ["ovftool ${var.output_directory}/${var.name}-update/${var.name}.vmx ${var.output_directory}/${var.name}-update.ova"]
}
}
}