#cloud-config
autoinstall:
  version: 1
  identity:
    hostname: naraborba
    username: nara
    password: "$6$r3PhGBw8BCIUyWYf$Ni3M9XLqV64VTeTNW2/WnDQa9pc7nwpV1/wL9G8HxriS76YzhlnRwBnwVLLoeMZ6YD4Uep8C8VNRqvdIGC7mu0"
  codecs:
    install: true
  drivers:
    install: true

  keyboard:
    layout: br
    toggle: null
    variant: ''
  locale: pt_BR.UTF-8
  network:
    ethernets:
      ens18:
        dhcp4: true
    version: 2
  source:
    id: ubuntu-desktop-minimal
    search_drivers: true
    
  timezone: America/Sao_Paulo
  updates: all

  packages:
  - net-tools
  - ca-certificates
  - curl
  - gnupg

  late-commands:
    - curtin in-target -- sh -c "install -m 0755 -d /etc/apt/keyrings"
    # Adiciona a chave GPG oficial do Docker
    - curtin in-target -- sh -c "curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg"
    # Adiciona o repositório do Docker
    - curtin in-target -- sh -c "echo 'deb [arch=\"$(dpkg --print-architecture)\" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo \"$VERSION_CODENAME\") stable' | tee /etc/apt/sources.list.d/docker.list > /dev/null"
    # Atualiza e instala os pacotes do Docker
    - curtin in-target -- sh -c "apt-get update"
    - curtin in-target -- sh -c "DEBIAN_FRONTEND=noninteractive apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin"


  shutdown: reboot