diff --git a/tasks/workstation/linux/software/lutris.yml b/tasks/workstation/linux/software/lutris.yml index 1db294f..756ca83 100644 --- a/tasks/workstation/linux/software/lutris.yml +++ b/tasks/workstation/linux/software/lutris.yml @@ -2,7 +2,21 @@ # Lutris for running Windows games not in Steam. # https://lutris.net/downloads -## Facts ## +# Paths + +- name: Workstation | Linux | Software | Lutris | Facts + set_fact: + lutris_source_list: "/etc/apt/sources.list.d/lutris.list" + lutris_keyfile: "/usr/share/keyrings/lutris.gpg" + when: ansible_pkg_mgr == "apt" + +# Checks + +- name: Workstation | Linux | Software | Lutris | Check PPA + stat: + path: "{{ lutris_source_list }}" + register: lutris_source_exists + when: ansible_pkg_mgr == "apt" ## Install Repo ## @@ -17,11 +31,13 @@ - name: Workstation | Linux | Software | Lutris | Add PPA (Debian) shell: "{{ item }}" loop: - - echo "deb [signed-by=/etc/apt/keyrings/lutris.gpg] https://download.opensuse.org/repositories/home:/strycore/Debian_12/ ./" | sudo tee /etc/apt/sources.list.d/lutris.list > /dev/null - - wget -q -O- https://download.opensuse.org/repositories/home:/strycore/Debian_12/Release.key | gpg --dearmor | sudo tee /etc/apt/keyrings/lutris.gpg > /dev/null - - sudo apt update - when: ansible_distribution in ("Debian") and gaming == true - ignore_errors: yes + - "wget -q -O- https://download.opensuse.org/repositories/home:/strycore/Debian_12/Release.key \ + | gpg --dearmor \ + | sudo tee {{ lutris_keyfile }} > /dev/null" + - "echo 'deb [signed-by={{ lutris_keyfile }}] https://download.opensuse.org/repositories/home:/strycore/Debian_12/ ./' \ + | sudo tee {{ lutris_source_list }} > /dev/null" + - "sudo apt update" + when: ansible_distribution in ("Debian") and gaming == true and not lutris_source_exists.stat.exists ## Install Package ## @@ -31,7 +47,6 @@ - lutris state: present when: ansible_architecture != "aarch64" and gaming == true - ignore_errors: yes ## Uninstall Package ## @@ -40,8 +55,7 @@ name: - lutris state: absent - when: ansible_architecture != "aarch64" and gaming is not defined - ignore_errors: yes + when: ansible_architecture != "aarch64" and gaming != true ## Uninstall Repo ## @@ -50,14 +64,13 @@ repo: ppa:lutris-team/lutris update_cache: yes state: absent - when: ansible_distribution in ("Ubuntu") and gaming is not defined + when: ansible_distribution in ("Ubuntu") and gaming != true ignore_errors: yes - name: Workstation | Linux | Software | Lutris | Remove PPA (Debian) shell: "{{ item }}" loop: - - mv /etc/apt/sources.list.d/lutris.list* ~/TRASH/ - - mv /etc/apt/keyrings/lutris.gpg ~/TRASH/ - - sudo apt update - when: ansible_distribution in ("Debian") and gaming is not defined - ignore_errors: yes + - "mv {{ lutris_source_list }} ~/TRASH/" + - "mv {{ lutris_keyfile }} ~/TRASH/" + - "sudo apt update" + when: ansible_distribution in ("Debian") and gaming != true and lutris_source_exists.stat.exists