#cloud-config
autoinstall:
    version: 1
    early-commands:
        # Stop ssh for packer
        - sudo systemctl stop ssh
    locale: en_US
    keyboard:
        layout: us
    identity:
        hostname: ubuntu-server
        username: wed
        password: '$1$Cc71g3Aa$WUMTLZg7B94dhHdxT7J/P/'
    ssh:
        install-server: yes
        allow-pw: yes
    storage:
        layout:
            name: lvm
    apt:
        geoip: true
        primary:
            - arches: [i386, amd64]
              uri: "http://archive.ubuntu.com/ubuntu"
    packages:
        - curl
        - unzip
        - openssh-server
        - util-linux-extra
#        - qemu-guest-agent
        - cloud-init
    user-data:
        disable_root: false
    late-commands:
        - sed -i -e 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /target/etc/ssh/sshd_config
        - sed -i -e 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /target/etc/ssh/sshd_config
        - echo 'wed ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/wed
        - curtin in-target --target=/target -- vmware-toolbox-cmd config set deployPkg enable-custom-scripts true
        - curtin in-target --target=/target -- chmod 440 /etc/sudoers.d/wed
        - curtin in-target --target=/target -- apt-get update
        - curtin in-target --target=/target -- apt-get upgrade --yes
