diff --git a/cloud-init-vm.yaml.tftpl b/cloud-init-vm.yaml.tftpl index 0738456..4035316 100644 --- a/cloud-init-vm.yaml.tftpl +++ b/cloud-init-vm.yaml.tftpl @@ -1,37 +1,36 @@ -#cloud-config package_update: true -%{ if length(each.value.extra_packages) > 0 } +%{ if length(each.value.extra_packages) > 0 ~} packages: -%{ for pkg in each.value.extra_packages } +%{ for pkg in each.value.extra_packages ~} - ${pkg} -%{ endfor } -%{ endif } +%{ endfor ~} +%{ endif ~} -%{ if length(each.value.extra_users) > 0 } +%{ if length(each.value.extra_users) > 0 ~} users: -%{ for u in each.value.extra_users } +%{ for u in each.value.extra_users ~} - name: ${u.name} groups: -%{ if length(u.groups) > 0 } -%{ for g in u.groups } +%{ if length(u.groups) > 0 ~} +%{ for g in u.groups ~} - ${g} -%{ endfor } -%{ endif } +%{ endfor ~} +%{ endif ~} shell: /bin/bash sudo: ALL=(ALL) NOPASSWD:ALL -%{ endfor } +%{ endfor ~} chpasswd: list: -%{ for u in each.value.extra_users } +%{ for u in each.value.extra_users ~} - ${u.name}:${u.password} -%{ endfor } +%{ endfor ~} expire: false -%{ endif } +%{ endif ~} -%{ if length(each.value.extra_runcmd) > 0 } +%{ if length(each.value.extra_runcmd) > 0 ~} runcmd: -%{ for cmd in each.value.extra_runcmd } +%{ for cmd in each.value.extra_runcmd ~} - ${cmd} -%{ endfor } -%{ endif } +%{ endfor ~} +%{ endif ~} \ No newline at end of file