|
| 1 | +# Remove legacy agnocast PPA configuration (if exists) |
| 2 | +- name: Remove legacy agnocast PPA via add-apt-repository |
| 3 | + ansible.builtin.command: add-apt-repository --remove ppa:t4-system-software/agnocast -y |
| 4 | + register: agnocast_legacy_ppa_remove |
| 5 | + failed_when: false |
| 6 | + changed_when: agnocast_legacy_ppa_remove.rc == 0 |
| 7 | + become: true |
| 8 | + |
| 9 | +- name: Remove legacy agnocast sources.list files |
| 10 | + ansible.builtin.shell: rm -f /etc/apt/sources.list.d/*agnocast*.list |
| 11 | + args: |
| 12 | + executable: /bin/bash |
| 13 | + register: agnocast_legacy_sources_remove |
| 14 | + changed_when: false |
| 15 | + become: true |
| 16 | + |
| 17 | +- name: Remove legacy agnocast GPG keys from trusted.gpg.d |
| 18 | + ansible.builtin.shell: rm -f /etc/apt/trusted.gpg.d/*agnocast*.gpg |
| 19 | + args: |
| 20 | + executable: /bin/bash |
| 21 | + register: agnocast_legacy_gpg_remove |
| 22 | + changed_when: false |
| 23 | + become: true |
| 24 | + |
1 | 25 | # TODO(rej55, sykwer): IPv6 support |
2 | 26 | - name: Save current IPv6 settings |
3 | 27 | ansible.builtin.shell: | |
|
18 | 42 | - { name: net.ipv6.conf.default.disable_ipv6 } |
19 | 43 | become: true |
20 | 44 |
|
21 | | -- name: Add agnocast PPA repository while IPv6 is disabled |
22 | | - ansible.builtin.apt_repository: |
23 | | - repo: ppa:t4-system-software/agnocast |
24 | | - state: present |
25 | | - update_cache: false |
| 45 | +- name: Create /etc/apt/keyrings directory |
| 46 | + ansible.builtin.file: |
| 47 | + path: /etc/apt/keyrings |
| 48 | + state: directory |
| 49 | + mode: "0755" |
| 50 | + become: true |
| 51 | + |
| 52 | +- name: Download agnocast PPA GPG key while IPv6 is disabled |
| 53 | + ansible.builtin.get_url: |
| 54 | + url: https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xCFDB1950382092423DF37D3E075CD8B5C91E5ACA |
| 55 | + dest: /tmp/agnocast-ppa.asc |
| 56 | + mode: "0644" |
| 57 | + register: agnocast_gpg_key_download |
| 58 | + |
| 59 | +- name: Convert GPG key to binary format and install |
| 60 | + ansible.builtin.shell: | |
| 61 | + gpg --dearmor < /tmp/agnocast-ppa.asc > /etc/apt/keyrings/agnocast-ppa.gpg |
| 62 | + chmod 0644 /etc/apt/keyrings/agnocast-ppa.gpg |
| 63 | + args: |
| 64 | + creates: /etc/apt/keyrings/agnocast-ppa.gpg |
| 65 | + become: true |
| 66 | + |
| 67 | +- name: Verify GPG key fingerprint |
| 68 | + ansible.builtin.shell: | |
| 69 | + set -o pipefail |
| 70 | + gpg --show-keys /etc/apt/keyrings/agnocast-ppa.gpg | grep -q 'CFDB1950382092423DF37D3E075CD8B5C91E5ACA' |
| 71 | + args: |
| 72 | + executable: /bin/bash |
| 73 | + register: agnocast_gpg_verify |
| 74 | + failed_when: agnocast_gpg_verify.rc != 0 |
| 75 | + changed_when: false |
| 76 | + |
| 77 | +- name: Display GPG key verification success |
| 78 | + ansible.builtin.debug: |
| 79 | + msg: "GPG key fingerprint verified successfully: CFDB1950382092423DF37D3E075CD8B5C91E5ACA" |
| 80 | + |
| 81 | +- name: Add agnocast repository |
| 82 | + ansible.builtin.copy: |
| 83 | + dest: /etc/apt/sources.list.d/agnocast.sources |
| 84 | + content: | |
| 85 | + Types: deb |
| 86 | + URIs: http://ppa.launchpad.net/t4-system-software/agnocast/ubuntu |
| 87 | + Suites: jammy |
| 88 | + Components: main |
| 89 | + Signed-By: /etc/apt/keyrings/agnocast-ppa.gpg |
| 90 | + mode: "0644" |
26 | 91 | become: true |
27 | 92 |
|
28 | 93 | - name: Restore original IPv6 settings # noqa: no-changed-when |
|
0 commit comments