#cloud-config
autoinstall:
  version: 1

  locale: it_IT.UTF-8

  keyboard:
    layout: it

  identity:
    hostname: srv-docker
    username: simaticadmin
    password: "$6$Cb4K2D7qVbm2..c0$mc0SulcRBu7Cku.y3QR78YAGufVzEpfMnoOSh.5MAPYsd2lE7GqYQ.JqrsbdYqLgyI9DGd62.IGGo6ClidxvE/"

  ssh:
    install-server: true
    allow-pw: true

  storage:
    layout:
      name: direct

  packages:
    - curl
    - ca-certificates
    - qemu-guest-agent
    - open-vm-tools

  late-commands:
    - curtin in-target -- bash -c "echo 'root:Password123!' | chpasswd"
    - curtin in-target -- passwd -u root
    - curtin in-target -- sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
    - curtin in-target -- sed -i 's/^#PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config || true
    - curtin in-target -- systemctl restart ssh
    - curtin in-target -- apt-get update
    - curtin in-target -- apt-get dist-upgrade -y
    - curtin in-target -- apt-get autoremove -y
    - curtin in-target -- apt-get clean