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