Debian Codegraph @

ansible_collections/community/zabbix/roles/zabbix_repo/tasks/Debian.yml

raw symbols SCIP
1 ---
2 - name: "Debian | Installing gnupg"
3 ansible.builtin.apt:
4 pkg: gnupg
5 update_cache: true
6 cache_valid_time: 3600
7 force: true
8 state: present
9 environment:
10 http_proxy: "{{ zabbix_http_proxy | default('') }}"
11 https_proxy: "{{ zabbix_https_proxy | default('') }}"
12 register: gnupg_installed
13 until: gnupg_installed is succeeded
14 become: true
15 tags:
16 - install
17
18 # In releases older than Debian 12 and Ubuntu 22.04, /etc/apt/keyrings does not exist by default.
19 # It SHOULD be created with permissions 0755 if it is needed and does not already exist.
20 # See: https://wiki.debian.org/DebianRepository/UseThirdParty
21 - name: "Debian | Create {{ zabbix_repo_keyring_path }} on older versions"
22 ansible.builtin.file:
23 path: "{{ zabbix_repo_keyring_path }}"
24 state: directory
25 mode: "0755"
26 become: true
27 when:
28 - (ansible_facts['distribution'] == "Ubuntu" and ansible_facts['distribution_major_version'] < "22") or
29 (ansible_facts['distribution'] == "Debian" and ansible_facts['distribution_major_version'] < "12")
30
31 - name: "Debian | Download gpg key"
32 when: not ansible_check_mode # Because get_url always has changed status in check_mode.
33 ansible.builtin.get_url:
34 url: "{{ zabbix_repo_deb_gpg_key_url }}"
35 dest: "{{ zabbix_repo_gpg_key }}"
36 mode: "0644"
37 force: true
38 environment:
39 http_proxy: "{{ zabbix_http_proxy | default('') }}"
40 https_proxy: "{{ zabbix_https_proxy | default('') }}"
41 register: zabbix_repo_files_installed
42 until: zabbix_repo_files_installed is succeeded
43 become: true
44 tags:
45 - install
46
47 - name: "Debian | Installing repository {{ ansible_facts['distribution'] }}"
48 ansible.builtin.copy:
49 dest: /etc/apt/sources.list.d/zabbix.sources
50 owner: root
51 group: root
52 mode: 0644
53 content: |
54 Types: deb{{ ' deb-src' if zabbix_repo_deb_include_deb_src }}
55 Enabled: yes
56 URIs: {{ zabbix_repo_deb_url }}
57 Suites: {{ ansible_facts['distribution_release'] }}
58 Components: {{ zabbix_repo_deb_component }}
59 Architectures: {{ zabbix_repo_deb_arch }}
60 Signed-By: {{ zabbix_repo_gpg_key }}
61 register: zabbix_repo_apt_file
62 become: true
63 tags:
64 - install
65
66 - name: "Debian | Create /etc/apt/preferences.d/"
67 ansible.builtin.file:
68 path: /etc/apt/preferences.d/
69 state: directory
70 mode: "0755"
71 become: true
72 tags:
73 - install
74
75 - name: "Debian | Configuring the weight for APT"
76 ansible.builtin.copy:
77 dest: "/etc/apt/preferences.d/{{ zabbix_repo_package }}"
78 content: |
79 Package: {{ zabbix_repo_package }}
80 Pin: origin repo.zabbix.com
81 Pin-Priority: {{ zabbix_repo_apt_priority }}
82 owner: root
83 mode: "0644"
84 when:
85 - zabbix_repo_package is defined
86 - zabbix_repo_package | length > 0
87 become: true
88 tags:
89 - install
90
91 - name: "Debian | Update apt cache if repo was added"
92 ansible.builtin.apt:
93 update_cache: true
94 when: zabbix_repo_apt_file.changed
95 become: true