---
- name: Install TLP
  pacman:
    name:
      - ethtool
      - tlp
      - tlp-rdw
    state: present
  tags:
    - tlp

- name: Push TLP battery threshold config
  copy:
    src: tlp/20-battery.conf
    dest: /etc/tlp.d/
  notify:
    - restart tlp
  tags:
    - tlp

- name: Push TLP radio device config
  copy:
    src: tlp/20-rdw.conf
    dest: /etc/tlp.d/
  notify:
    - restart tlp
  tags:
    - tlp

- name: Push TLP PCIe config
  copy:
    src: tlp/20-pcie.conf
    dest: /etc/tlp.d/
  notify:
    - restart tlp
  tags:
    - tlp

- name: Mask systemd radio service
  command: systemctl mask systemd-rfkill.service
  tags:
    - tlp

- name: Mask systemd radio socket
  command: systemctl mask systemd-rfkill.socket
  tags:
    - tlp

- name: Enable TLP
  service:
    name: tlp.service
    enabled: yes
  tags:
    - tlp
