diff --git a/cloud-init-vm.yaml.tftpl b/cloud-init-vm.yaml.tftpl index dc80993..b89be0b 100644 --- a/cloud-init-vm.yaml.tftpl +++ b/cloud-init-vm.yaml.tftpl @@ -1,30 +1,31 @@ + +#cloud-config package_update: true packages: %{ for pkg in each.value.extra_packages ~} - - ${pkg} + - ${pkg} %{ endfor ~} -users: %{ if length(each.value.extra_users) > 0 ~} - +users: %{ for u in each.value.extra_users ~} - - name: ${u.name} - groups: [${join(", ", u.groups)}] - shell: /bin/bash - sudo: ALL=(ALL) NOPASSWD:ALL + - 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} + list: | +%{ for u in each.value.extra_users ~} + ${u.name}:${u.password} %{ endfor ~} -%{ endif ~} \ No newline at end of file + expire: false +%{ endif ~} + +%{ if length(each.value.extra_runcmd) > 0 ~} +runcmd: +%{ for cmd in each.value.extra_runcmd ~} + - ${cmd} +%{ endfor ~} +%{ endif ~}