--- - name: Set up firefox hosts: localhost vars: uid: "{{ lookup('env','USER') }}" host_app_url: https://github.com/passff/passff-host/releases/latest/download/install_host_app.sh key_path: /etc/apt/keyrings/packages.mozilla.org.asc key_url: https://packages.mozilla.org/apt/repo-signing-key.gpg connection: local become: false tasks: - name: Have key allready installed stat: path: '{{key_path}}' register: key - name: Get key become: true ansible.builtin.command: chdir: /tmp cmd: wget -O '{{ key_path }}' '{{ key_url }}' creates: '{{key_path}}' when: not key.stat.exists # - name: Dearmor key # ansible.builtin.command: # chdir: /tmp # cmd: gpg --dearmor -o {{ key_path }} ./keyring.gpg # creates: '{{key_path}}' # become: true # when: not key.stat.exists - name: install repo become: true ansible.builtin.template: src: ../templates/firefox.sources.j2 dest: /etc/apt/sources.list.d/firefox.sources when: not key.stat.exists - name: Install apt package become: true ansible.builtin.apt: autoclean: true autoremove: true install_recommends: true pkg: [firefox] state: latest update_cache: true - name: Get host app ansible.builtin.command: chdir: /tmp cmd: wget {{ host_app_url }} creates: /tmp/install_host_app.sh when: not key.stat.exists - name: Install host app ansible.builtin.command: cmd: bash /tmp/install_host_app.sh firefox when: not key.stat.exists - name: Clean up ansible.builtin.command: chdir: /tmp cmd: rm ./install_host_app.sh ./keyring.gpg removes: [/tmp/install_host_app.sh, /tmp/keyring.gpg] when: not key.stat.exists