- name: Installer les logiciels sur le CM4
  hosts: nebuleair_pro
  become: yes  # Ensure tasks run with sudo
  tasks:
    - name: Mettre à jour les paquets
      apt:
        update_cache: yes
        upgrade: dist

    - name: Install necessary packages
      apt:
        name:
          - git
          - gh
          - apache2
          - php
          - python3
          - python3-pip
          - jq
          - autossh
          - i2c-tools
          - python3-smbus
        state: present                        # Ensure the package is installed
        update_cache: yes

    - name: Install required Python packages
      pip:
        name:
          - pyserial
          - requests
          - RPi.GPIO
          - adafruit-circuitpython-bme280
        state: present
        executable: pip3                      #Specifies which version of pip to use (in this case, pip3).
        extra_args: --break-system-packages


