---
- hosts: all
  tasks:
    - include_tasks: sysctl.yml
    - include_tasks: makepkg.yml
    - include_tasks: system_packages.yml
    - include_tasks: user_configuration.yml
    - include_tasks: fonts.yml
    - include_tasks: network.yml

    - name: Set i915 module options
      copy:
        src: files/i915.conf
        dest: /etc/modprobe.d/i915.conf

    - name: Enable pkgfile auto update timer
      systemd:
        name: pkgfile-update.timer
        state: started
        enabled: True

    - name: Make Apple keyboard to use function keys by default
      copy:
        src: files/hid_apple.conf
        dest: /etc/modprobe.d/hid_apple.conf
      notify: set hid_apple fnmode for current session

    - name: Disable Intel TCO watchdog
      copy:
        src: files/iTCO_wdt_blacklist.conf
        dest: /etc/modprobe.d/iTCO_wdt_blacklist.conf

    - name: Disable pc speakers (internal beep)
      copy:
        src: files/nobeep.conf
        dest: /etc/modprobe.d/nobeep.conf

    - name: Enable thermald
      systemd:
        name: thermald
        state: started
        enabled: True

    - name: Enable periodic TRIM
      systemd:
        name: fstrim.timer
        state: started
        enabled: True

  handlers:
    - name: set hid_apple fnmode for current session
      shell: echo 2 > /sys/module/hid_apple/parameters/fnmode

    - name: restart network manager
      systemd:
        name: NetworkManager
        state: restarted

  vars_files:
    - variables.yml

---
- hosts: all
  tasks:
    - include_tasks: sysctl.yml
    - include_tasks: makepkg.yml
    - include_tasks: system_packages.yml
    - include_tasks: user_configuration.yml
    - include_tasks: fonts.yml
    - include_tasks: network.yml

    - name: Set i915 module options
      copy:
        src: files/i915.conf
        dest: /etc/modprobe.d/i915.conf

    - name: Enable pkgfile auto update timer
      systemd:
        name: pkgfile-update.timer
        state: started
        enabled: True

    - name: Make Apple keyboard to use function keys by default
      copy:
        src: files/hid_apple.conf
        dest: /etc/modprobe.d/hid_apple.conf

    - name: Disable Intel TCO watchdog
      copy:
        src: files/iTCO_wdt_blacklist.conf
        dest: /etc/modprobe.d/iTCO_wdt_blacklist.conf

    - name: Disable pc speakers (internal beep)
      copy:
        src: files/nobeep.conf
        dest: /etc/modprobe.d/nobeep.conf

    - name: Enable thermald
      systemd:
        name: thermald
        state: started
        enabled: True

    - name: Enable periodic TRIM
      systemd:
        name: fstrim.timer
        state: started
        enabled: True

  handlers:
    - name: restart network manager
      systemd:
        name: NetworkManager
        state: restarted

  vars_files:
    - variables.yml

Remove Ansible Apple keyboard handler
Remove Ansible Apple keyboard handler
