---
-
  name: "Upgrade all apt packages"
  when: ansible_os_family == 'Debian' and (deb_architecture.stdout == 'arm64' or deb_architecture.stdout == 'armhf')
  ansible.builtin.apt:
    name:
      - python3-smbus
      - python3-gpiozero
      - python3-rpi.gpio
      - i2c-tools
      - python3-smbus
      - 2to3
      - python3-lgpio

-
  name: "Adding x728 Scripts"
  when: ansible_os_family == 'Debian' and (deb_architecture.stdout == 'arm64' or deb_architecture.stdout == 'armhf')
  ansible.builtin.template:
    mode: a+x
    dest: "{{ item.dest }}"
    src: "{{ item.src }}"
  with_items:
    -
      src: x728v2-asd.py.j2
      dest: "/usr/local/bin/x728v2-asd.py"
    -
      src: x728plsd.py.j2
      dest: "/usr/local/bin/x728plsd.py"
    -
      src: x728pld.py.j2
      dest: "/usr/local/bin/x728pld.py"
    -
      src: x728bat.py.j2
      dest: "/usr/local/bin/x728bat.py"
    -
      src: x728pwr.sh.j2
      dest: "/usr/local/bin/x728pwr.sh"
    -
      src: x728softsd.sh.j2
      dest: "/usr/local/bin/x728softsd.sh"

-
  name: "Enabling RTC on Next Reboot"
  when: ansible_os_family == 'Debian' and (deb_architecture.stdout == 'arm64' or deb_architecture.stdout == 'armhf')
  ansible.builtin.lineinfile:
    line: "{{ item.line }}"
    path:  /etc/modules
    state: present
    create: true
  with_items:
    - line: 'rtc-ds1307'
