---

- name: Install required packages
  apt:
    update_cache: yes
    pkg: '{{ required_packages }}'

- name: Create the odoo user
  user:
    name: odoo
    uid: 1001
    home: /home/odoo
    group: users
    groups:
      - video
    shell: /usr/bin/bash
    password: '!'

- import_tasks: autologin_odoo_user.yml

- import_tasks: allow_remote_page_refresh.yml

- import_tasks: show_desktop_periodically.yml

- name: Identificar el modelo de Raspberry Pi
  command: cat /proc/device-tree/model
  register: pi_model_result
  changed_when: false # Este comando solo lee información, no cambia nada.

- name: Copiar configuración de X11 solo si es una Raspberry Pi 5
  copy:
    src: 99-v3d.conf
    dest: /etc/X11/xorg.conf.d/99-v3d.conf
    owner: root
    group: root
    mode: '0644'
  when: "'Raspberry Pi 5' in pi_model_result.stdout"
