|
3 | 3 |
|
4 | 4 | --- |
5 | 5 |
|
6 | | -- name: Install gpg |
| 6 | +- name: Install gpg and apt-transport-https |
7 | 7 | ansible.builtin.apt: |
8 | | - name: gpg |
| 8 | + name: |
| 9 | + - gpg |
| 10 | + - apt-transport-https |
9 | 11 | state: present |
10 | 12 | update_cache: yes |
11 | 13 | become: true |
12 | 14 | when: not ansible_check_mode |
13 | 15 |
|
14 | | -- name: Add Mondoo apt repository key. |
15 | | - ansible.builtin.get_url: |
16 | | - url: "{{ mondoo_deb_gpgkey }}" |
17 | | - dest: "/etc/apt/trusted.gpg.d/mondoo.asc" |
18 | | - mode: '0644' |
19 | | - force: true |
20 | | - become: true |
21 | | - when: not ansible_check_mode |
| 16 | +- name: Configure repository for Debian <= 12 and other distributions |
| 17 | + when: |
| 18 | + - not ansible_check_mode |
| 19 | + - ansible_distribution != "Debian" or (ansible_distribution == "Debian" and ansible_distribution_major_version | int <= 12) |
| 20 | + block: |
| 21 | + - name: Add Mondoo apt repository key. |
| 22 | + ansible.builtin.get_url: |
| 23 | + url: "{{ mondoo_deb_gpgkey }}" |
| 24 | + dest: "/etc/apt/trusted.gpg.d/mondoo.asc" |
| 25 | + mode: '0644' |
| 26 | + force: true |
| 27 | + become: true |
22 | 28 |
|
23 | | -- name: Pack Mondoo gpg key |
24 | | - ansible.builtin.command: gpg --dearmor --batch --yes --output {{ mondoo_deb_gpgkey_dest }} /etc/apt/trusted.gpg.d/mondoo.asc |
25 | | - changed_when: false |
26 | | - no_log: true |
27 | | - become: "{{ use_become }}" |
| 29 | + - name: Pack Mondoo gpg key |
| 30 | + ansible.builtin.command: gpg --dearmor --batch --yes --output {{ mondoo_deb_gpgkey_dest }} /etc/apt/trusted.gpg.d/mondoo.asc |
| 31 | + changed_when: false |
| 32 | + no_log: true |
| 33 | + become: "{{ use_become }}" |
| 34 | + |
| 35 | + - name: Configure Mondoo deb repository |
| 36 | + ansible.builtin.apt_repository: |
| 37 | + repo: "deb [signed-by={{ mondoo_deb_gpgkey_dest }}] {{ mondoo_deb_repo }}" |
| 38 | + filename: "mondoo" |
| 39 | + state: "present" |
| 40 | + update_cache: yes |
| 41 | + become: "{{ use_become }}" |
28 | 42 |
|
29 | | -- name: Install apt-transport-https |
| 43 | +- name: Install python3-debian for DEB822 repository support (Debian 13+) |
30 | 44 | ansible.builtin.apt: |
31 | | - name: apt-transport-https |
| 45 | + name: python3-debian |
32 | 46 | state: present |
33 | 47 | update_cache: yes |
34 | 48 | become: true |
35 | | - when: not ansible_check_mode |
| 49 | + when: |
| 50 | + - not ansible_check_mode |
| 51 | + - ansible_distribution == "Debian" |
| 52 | + - ansible_distribution_major_version | int >= 13 |
36 | 53 |
|
37 | | -- name: Configure Mondoo deb repository |
38 | | - ansible.builtin.apt_repository: |
39 | | - repo: "deb [signed-by={{ mondoo_deb_gpgkey_dest }}] {{ mondoo_deb_repo }}" |
40 | | - filename: "mondoo" |
41 | | - state: "present" |
42 | | - update_cache: yes |
| 54 | +- name: Configure Mondoo deb repository (DEB822 format) |
| 55 | + ansible.builtin.deb822_repository: |
| 56 | + name: mondoo |
| 57 | + types: deb |
| 58 | + uris: "{{ mondoo_deb_repo_base_url }}" |
| 59 | + suites: stable |
| 60 | + components: main |
| 61 | + signed_by: "{{ mondoo_deb_gpgkey }}" |
43 | 62 | become: "{{ use_become }}" |
44 | | - when: not ansible_check_mode |
| 63 | + when: |
| 64 | + - not ansible_check_mode |
| 65 | + - ansible_distribution == "Debian" |
| 66 | + - ansible_distribution_major_version | int >= 13 |
45 | 67 |
|
46 | 68 | - name: Ensure cnquery and cnspec are installed |
47 | 69 | ansible.builtin.apt: |
|
0 commit comments