#cloud-config
autoinstall:
  version: 1
  locale: es_ES.UTF-8
  timezone: Atlantic/Canary

  identity:
    username: operador
    password: '$6$uOoIdLUDLwDf9GrC$v6VkFVpJIpWkrRXlx.GpqiOhEYMWq38oCyosg.hS861avCMyyBpF9z/jJ/vVfbPb3Y8OnAI9RWrRrI84uRdh/.'
    hostname: nuryana500

  drivers:
    install: true

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

  keyboard:
    layout: es
    toggle: null

  network:
    version: 2
    ethernets:
      eth0:
        dhcp4: true
  
  source:
    id: ubuntu-desktop

  storage:
    layout:
      name: direct
      match:
        size: smallest

  packages:
    - snapd

  late-commands:
    - curtin in-target --target=/target -- apt update
    - curtin in-target --target=/target -- apt upgrade -y

    # Crear usuarios y asignarles contraseña predefinida
    - curtin in-target --target=/target -- adduser --quiet --gecos "" --disabled-password eso1
    - curtin in-target --target=/target -- bash -c "echo 'eso1:extintornuryana' | chpasswd"
    - curtin in-target --target=/target -- adduser --quiet --gecos "" --disabled-password eso2
    - curtin in-target --target=/target -- bash -c "echo 'eso2:camisetanuryana' | chpasswd"
    - curtin in-target --target=/target -- adduser --quiet --gecos "" --disabled-password eso3
    - curtin in-target --target=/target -- bash -c "echo 'eso3:corbatanuryana' | chpasswd"
    - curtin in-target --target=/target -- adduser --quiet --gecos "" --disabled-password eso4
    - curtin in-target --target=/target -- bash -c "echo 'eso4:acelganuryana' | chpasswd"
    - curtin in-target --target=/target -- adduser --quiet --gecos "" --disabled-password bach1
    - curtin in-target --target=/target -- bash -c "echo 'bach1:escaleranuryana' | chpasswd"
    - curtin in-target --target=/target -- adduser --quiet --gecos "" --disabled-password bach2
    - curtin in-target --target=/target -- bash -c "echo 'bach2:navidadnuryana' | chpasswd"

    # Instalar snaps solicitados
    - curtin in-target --target=/target -- snap install krita
    - curtin in-target --target=/target -- snap install audacity --candidate
    - curtin in-target --target=/target -- snap install blender --classic
    - curtin in-target --target=/target -- snap install gimp
    - curtin in-target --target=/target -- snap install inkscape
    - curtin in-target --target=/target -- snap install brave

  shutdown: reboot

