---
# Sync and update Pacman
- name: Sync and update Pacman
  community.general.pacman:
    update_cache: yes
    upgrade: yes
  become: yes
  tags: update
# Pacman hardware controllers
- name: Ensure common hardware controllers installed via Pacman
  community.general.pacman:
    name: 
      - bluez
      - bluez-utils
      - ufw
      - intel-media-driver
      - intel-gpu-tools
      - tlp
    state: present
  become: yes
# TLP
- name: Create tlp.conf file
  copy:
    dest: "/etc/tlp.conf"
    content: |
      PCIE_ASPM_ON_BAT=powersupersave
  become: yes
- name: Ensure tlp service enabled and running
  ansible.builtin.systemd:
    name: tlp
    state: started
    enabled: yes
  become: yes
# Bluetooth
- name: Ensure bluetooth service started
  ansible.builtin.systemd:
    name: bluetooth
    state: started
    enabled: yes
  become: yes
# UFW
- name: Ensure UFW installed
  community.general.pacman:
    name: ufw
    state: present
  become: yes
- name: Enable UFW
  community.general.ufw:
    state: enabled
  become: yes
- name: Allow SSH
  community.general.ufw:
    rule: allow
    name: ssh
  become: yes
