#cloud-config preserve_hostname: false hostname: ${hostname} fqdn: ${hostname}.${domain} # prefer_fqdn_over_hostname: true %{ if allow_passwords ~} ssh_pwauth: true %{ endif ~} groups: - wheel users: - name: ${user} sudo: ALL=(ALL) NOPASSWD:ALL shell: /bin/bash groups: users, admin, sudo %{ if allow_passwords ~} passwd: "${password_hash}" %{ endif ~} lock_passwd: %{ if allow_passwords ~}false%{ else }true%{ endif } ssh_authorized_keys: %{ if authorized_key != "" ~} - "${authorized_key}" %{ endif ~} %{ for key in authorized_keys ~} - "${key}" %{ endfor ~} packages: - vim - telnet - bash-completion - htop - tree - lvm2 %{ for pkg in packages ~} - ${pkg} %{ endfor ~} bootcmd: - echo "127.0.0.1 ${hostname}.${domain} ${hostname}" >> /etc/hosts runcmd: - rm /etc/skel/.bashrc - apt update - apt install -y qemu-guest-agent ca-certificates - systemctl enable qemu-guest-agent - systemctl start qemu-guest-agent - apt upgrade %{ for cmd in commands ~} - ${cmd} %{ endfor ~} - echo "$(date): Success" > /var/log/provisionned final_message: "The system is ready, after $UPTIME seconds"