Update cloud-init-vm.yaml.tftpl

This commit is contained in:
2025-08-27 20:18:34 +00:00
parent 783c4fcb33
commit ae89f7062c

View File

@ -1,37 +1,36 @@
#cloud-config
package_update: true package_update: true
%{ if length(each.value.extra_packages) > 0 } %{ if length(each.value.extra_packages) > 0 ~}
packages: packages:
%{ for pkg in each.value.extra_packages } %{ for pkg in each.value.extra_packages ~}
- ${pkg} - ${pkg}
%{ endfor } %{ endfor ~}
%{ endif } %{ endif ~}
%{ if length(each.value.extra_users) > 0 } %{ if length(each.value.extra_users) > 0 ~}
users: users:
%{ for u in each.value.extra_users } %{ for u in each.value.extra_users ~}
- name: ${u.name} - name: ${u.name}
groups: groups:
%{ if length(u.groups) > 0 } %{ if length(u.groups) > 0 ~}
%{ for g in u.groups } %{ for g in u.groups ~}
- ${g} - ${g}
%{ endfor } %{ endfor ~}
%{ endif } %{ endif ~}
shell: /bin/bash shell: /bin/bash
sudo: ALL=(ALL) NOPASSWD:ALL sudo: ALL=(ALL) NOPASSWD:ALL
%{ endfor } %{ endfor ~}
chpasswd: chpasswd:
list: list:
%{ for u in each.value.extra_users } %{ for u in each.value.extra_users ~}
- ${u.name}:${u.password} - ${u.name}:${u.password}
%{ endfor } %{ endfor ~}
expire: false expire: false
%{ endif } %{ endif ~}
%{ if length(each.value.extra_runcmd) > 0 } %{ if length(each.value.extra_runcmd) > 0 ~}
runcmd: runcmd:
%{ for cmd in each.value.extra_runcmd } %{ for cmd in each.value.extra_runcmd ~}
- ${cmd} - ${cmd}
%{ endfor } %{ endfor ~}
%{ endif } %{ endif ~}