Skip to content

Commit

Permalink
[packer] Allow setting CPUs via the environment
Browse files Browse the repository at this point in the history
  • Loading branch information
binary-manu committed Mar 31, 2024
1 parent ba454a2 commit 57b5f28
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packer/packer-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"off_cmd" : "poweroff",
"nat_key" : "{{env `ARCH_ANSIBLE_PACKER_VBOX_NAT_LOCALHOST_KEY`}}",
"nat_val" : "{{env `ARCH_ANSIBLE_PACKER_VBOX_NAT_LOCALHOST_VAL`}}",
"headless" : "{{env `ARCH_ANSIBLE_PACKER_HEADLESS`}}"
"headless" : "{{env `ARCH_ANSIBLE_PACKER_HEADLESS`}}",
"cpus" : "{{env `ARCH_ANSIBLE_PACKER_CPUS`}}"
},

"builders": [
Expand All @@ -35,6 +36,7 @@
"shutdown_command" : "{{ user `off_cmd` }}",
"ssh_username" : "root",
"ssh_clear_authorized_keys" : false,
"cpus" : "{{ user `cpus` }}",
"memory" : "{{ user `memory` }}",
"disk_size" : "{{ user `disk_size` }}",
"hard_drive_interface" : "sata",
Expand Down Expand Up @@ -64,6 +66,7 @@
"shutdown_command" : "{{ user `off_cmd` }}",
"ssh_username" : "root",
"ssh_clear_authorized_keys" : false,
"cpus" : "{{ user `cpus` }}",
"memory" : "{{ user `memory` }}",
"disk_size" : "{{ user `disk_size` }}",
"hard_drive_interface" : "sata",
Expand All @@ -86,6 +89,7 @@
"shutdown_command" : "{{ user `off_cmd` }}",
"ssh_username" : "root",
"ssh_clear_authorized_keys" : false,
"cpus" : "{{ user `cpus` }}",
"memory" : "{{ user `memory` }}",
"disk_size" : "{{ user `disk_size` }}",
"ssh_private_key_file": "./insecure_key",
Expand Down
6 changes: 6 additions & 0 deletions packer/packer-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@ else
export ARCH_ANSIBLE_PACKER_HEADLESS=false
fi

if [ -n "$ARCH_ANSIBLE_CPUS" ]; then
export ARCH_ANSIBLE_PACKER_CPUS="$ARCH_ANSIBLE_CPUS"
else
export ARCH_ANSIBLE_PACKER_CPUS=1
fi

packer "$@"

0 comments on commit 57b5f28

Please sign in to comment.