@@ -22,9 +22,9 @@ source "qemu" "rocm" {
2222 efi_drop_efivars = true # don't place efivars.fd in output artifact
2323 format = " raw" # qcow2 may not be converted. if written to drives, can't be read back/won't find 'curtin'
2424 headless = var. hidden
25- shutdown_command = " sudo -S shutdown -P now"
25+ shutdown_command = " sudo -S bash -c \" rm -fv /etc/sudoers.d/packer /etc/sudoers.d/90-cloud-init-users; userdel --remove --force packer; shutdown -P now\" "
2626 ssh_handshake_attempts = 500
27- ssh_username = " ubuntu "
27+ ssh_username = " packer "
2828 ssh_password = " ubuntu"
2929 ssh_wait_timeout = " 1h"
3030 ssh_timeout = " 1h"
@@ -36,12 +36,13 @@ source "qemu" "rocm" {
3636build {
3737 sources = [" source.qemu.rocm" ]
3838
39- # generate /copy tarball of custom packages; 'packer-maas' will process
39+ # regenerate /copy tarball of custom packages; 'packer-maas' will process
4040 provisioner "shell-local" {
4141 inline = [
42- " tar cvzf ${ path . root } /custom-packages.tar.gz -C ${ path . root } /packages --overwrite ." ,
42+ " rm -f ${ path . root } /custom-packages.tar.gz" ,
43+ " tar cvzf ${ path . root } /custom-packages.tar.gz -C ${ path . root } /packages ."
4344 ]
44- inline_shebang = " /bin/bash -e "
45+ inline_shebang = " /bin/bash"
4546 }
4647 provisioner "file" {
4748 destination = " /tmp/"
@@ -76,9 +77,29 @@ build {
7677 scripts = [" ${ path . root } /../packer-maas/ubuntu/scripts/curtin.sh" , " ${ path . root } /../packer-maas/ubuntu/scripts/networking.sh" , " ${ path . root } /../packer-maas/ubuntu/scripts/cloudimg/install-custom-kernel.sh" ]
7778 }
7879
80+ provisioner "ansible" {
81+ playbook_file = " ${ path . root } /../playbooks/sos.yml"
82+ user = " packer"
83+ ansible_env_vars = [" http_proxy=${ var . http_proxy } " , " https_proxy=${ var . https_proxy } " , " no_proxy=${ var . no_proxy } " ]
84+ extra_arguments = [
85+ " -e" , " ansible_python_interpreter=/usr/bin/python3" ,
86+ " --scp-extra-args" , " '-O'"
87+ ]
88+ }
89+
90+ provisioner "ansible" {
91+ playbook_file = " ${ path . root } /../playbooks/limits.yml"
92+ user = " packer"
93+ ansible_env_vars = [" http_proxy=${ var . http_proxy } " , " https_proxy=${ var . https_proxy } " , " no_proxy=${ var . no_proxy } " ]
94+ extra_arguments = [
95+ " -e" , " ansible_python_interpreter=/usr/bin/python3" ,
96+ " --scp-extra-args" , " '-O'"
97+ ]
98+ }
99+
79100 provisioner "ansible" {
80101 playbook_file = " ${ path . root } /../playbooks/os_prep.yml"
81- user = " ubuntu "
102+ user = " packer "
82103 ansible_env_vars = [" http_proxy=${ var . http_proxy } " , " https_proxy=${ var . https_proxy } " , " no_proxy=${ var . no_proxy } " ]
83104 extra_arguments = [
84105 " -e" , " ansible_python_interpreter=/usr/bin/python3" , # work around Packer/SSH proxy+client limitations
@@ -89,7 +110,7 @@ build {
89110
90111 provisioner "ansible" {
91112 playbook_file = " ${ path . root } /../playbooks/amdgpu_install.yml"
92- user = " ubuntu "
113+ user = " packer "
93114 ansible_env_vars = [" http_proxy=${ var . http_proxy } " , " https_proxy=${ var . https_proxy } " , " no_proxy=${ var . no_proxy } " ]
94115 extra_arguments = [
95116 " -e" , " ansible_python_interpreter=/usr/bin/python3" ,
@@ -106,7 +127,7 @@ build {
106127
107128 provisioner "ansible" {
108129 playbook_file = " ${ path . root } /../playbooks/tuned.yml"
109- user = " ubuntu "
130+ user = " packer "
110131 ansible_env_vars = [" http_proxy=${ var . http_proxy } " , " https_proxy=${ var . https_proxy } " , " no_proxy=${ var . no_proxy } " ]
111132 extra_arguments = [
112133 " -e" , " ansible_python_interpreter=/usr/bin/python3" ,
@@ -116,7 +137,7 @@ build {
116137
117138 provisioner "ansible" {
118139 playbook_file = " ${ path . root } /../playbooks/niccli.yml"
119- user = " ubuntu "
140+ user = " packer "
120141 ansible_env_vars = [" http_proxy=${ var . http_proxy } " , " https_proxy=${ var . https_proxy } " , " no_proxy=${ var . no_proxy } " ]
121142 extra_arguments = [
122143 " -e" , " ansible_python_interpreter=/usr/bin/python3" ,
@@ -130,7 +151,7 @@ build {
130151
131152 provisioner "ansible" {
132153 playbook_file = " ${ path . root } /../playbooks/tuned.yml"
133- user = " ubuntu "
154+ user = " packer "
134155 ansible_env_vars = [" http_proxy=${ var . http_proxy } " , " https_proxy=${ var . https_proxy } " , " no_proxy=${ var . no_proxy } " ]
135156 extra_arguments = [
136157 " -e" , " ansible_python_interpreter=/usr/bin/python3" ,
0 commit comments