create cloud-init-vm.yaml.tftpl

This commit is contained in:
2025-08-26 16:59:44 +00:00
parent 28f183d71b
commit 2d1792d0dd

31
cloud-init-vm.yaml.tftpl Normal file
View File

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