#cloud-config
autoinstall:
  version: 1
  identity:
    hostname: ubuntu
    username: ubuntu
    password: '$y$j9T$tJDMoDcWjf3et4SVGinXQ.$4DNtULekpWpr7tJ9LYZKaLXVb7BOh/bAgA0kjRL47/5'
  early-commands:
    # otherwise packer tries to connect and exceed max attempts:
    - systemctl stop ssh
  packages:
    - openssh-server
  ssh:
    install-server: yes
    allow-pw: yes
  late-commands:
      # - 'sed -i "s/dhcp4: true/&\n      dhcp-identifier: mac/" /target/etc/netplan/00-installer-config.yaml'
      - echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/ubuntu
      - if [ $(virt-what) == "hyperv" ]; then apt-get update && apt-get install -y hyperv-daemons linux-tools-$(uname -r) linux-cloud-tools-$(uname -r) linux-cloud-tools-common cifs-utils && systemctl enable hypervvssd && systemctl enable hypervkvpd && systemctl start hypervvssd && systemctl start hypervkvpd; fi