Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to deb822 formatting and allow debian repo selection #1090

Merged
merged 4 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/deb822.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- all roles - Updated Debian repository format to 822 standard
- all roles - Re-added ability to override Debian repo source
2 changes: 2 additions & 0 deletions docs/ZABBIX_AGENT_ROLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ The following is an overview of all available configuration default for this rol
* `zabbix_repo_yum`: A list with Yum repository configuration.
* `zabbix_repo_yum_schema`: Default: `https`. Option to change the web schema for the yum repository(http/https)
* `zabbix_agent_disable_repo`: A list of repos to disable during install. Default `epel`.
* `zabbix_repo_deb_url`: The URL to the Zabbix repository. Default `http://repo.zabbix.com/zabbix/{{ zabbix_agent_version }}/{{ ansible_distribution.lower() }}`
* `zabbix_repo_deb_component`: The repository component for Debian installs. Default `main`.

### SElinux

Expand Down
2 changes: 2 additions & 0 deletions docs/ZABBIX_JAVAGATEWAY_ROLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ The `zabbix_javagateway_version` is optional. The latest available major.minor v
* `zabbix_javagateway_disable_repo`: A list of repos to disable during install. Default `epel`.
* `zabbix_javagateway_package_state`: Default: `present`. Can be overridden to `latest` to update packages when needed.
* `zabbix_javagateway_conf_mode`: Default: `0644`. The "mode" for the Zabbix configuration file.
* `zabbix_repo_deb_url`: The URL to the Zabbix repository. Default `http://repo.zabbix.com/zabbix/{{ zabbix_agent_version }}/{{ ansible_distribution.lower() }}`
* `zabbix_repo_deb_component`: The repository component for Debian installs. Default `main`.

### Java Gatewaty

Expand Down
2 changes: 2 additions & 0 deletions docs/ZABBIX_PROXY_ROLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ The following is an overview of all available configuration default for this rol
* `zabbix_proxy_disable_repo`: A list of repos to disable during install. Default `epel`.
* `zabbix_proxy_apt_priority`: APT priority for the zabbix repository
* `*zabbix_proxy_package_state`: Default: `present`. Can be overridden to `latest` to update packages
* `zabbix_repo_deb_url`: The URL to the Zabbix repository. Default `http://repo.zabbix.com/zabbix/{{ zabbix_proxy_version }}/{{ ansible_distribution.lower() }}`
* `zabbix_repo_deb_component`: The repository component for Debian installs. Default `main`.
### SElinux

* `zabbix_proxy_selinux`: Default: `False`. Enables an SELinux policy so that the Proxy will run.
Expand Down
2 changes: 2 additions & 0 deletions docs/ZABBIX_SERVER_ROLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ The following is an overview of all available configuration default for this rol
* `zabbix_server_disable_repo`: A list of repos to disable during install. Default `epel`.
* `zabbix_service_state`: Default: `started`. Can be overridden to stopped if needed
* `zabbix_service_enabled`: Default: `True` Can be overridden to `False` if needed
* `zabbix_repo_deb_url`: The URL to the Zabbix repository. Default `http://repo.zabbix.com/zabbix/{{ zabbix_server_version }}/{{ ansible_distribution.lower() }}`
* `zabbix_repo_deb_component`: The repository component for Debian installs. Default `main`.

### SElinux

Expand Down
2 changes: 2 additions & 0 deletions docs/ZABBIX_WEB_ROLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ The following is an overview of all available configuration defaults for this ro
* `zabbix_web_package_state`: Default: `present`. Can be overridden to `latest` to update packages when needed.
* `zabbix_web_doubleprecision`: Default: `False`. For upgraded installations, please read database [upgrade notes](https://www.zabbix.com/documentation/current/manual/installation/upgrade_notes_500) (Paragraph "Enabling extended range of numeric (float) values") before enabling this option.
* `zabbix_web_conf_mode`: Default: `0644`. The "mode" for the Zabbix configuration file.
* `zabbix_repo_deb_url`: The URL to the Zabbix repository. Default `http://repo.zabbix.com/zabbix/{{ zabbix_web_version }}/{{ ansible_distribution.lower() }}`
* `zabbix_repo_deb_component`: The repository component for Debian installs. Default `main`.

### Zabbix Web specific

Expand Down
2 changes: 2 additions & 0 deletions roles/zabbix_agent/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ zabbix_repo_yum:
gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
state: present

zabbix_repo_deb_component: main

# Zabbix API stuff
zabbix_api_server_host: localhost
# zabbix_api_server_port: 80
Expand Down
36 changes: 16 additions & 20 deletions roles/zabbix_agent/tasks/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,15 @@
- name: "Debian | Set some variables"
ansible.builtin.set_fact:
zabbix_short_version: "{{ zabbix_agent_version | regex_replace('\\.', '') }}"
zabbix_agent_apt_repository:
- "http://repo.zabbix.com/zabbix/{{ zabbix_agent_version }}/{{ ansible_distribution.lower() }}/"
- "{{ ansible_distribution_release }}"
- "main"
zabbix_underscore_version: "{{ zabbix_agent_version | regex_replace('\\.', '_') }}"
when:
- ansible_machine != "aarch64"
tags:
- always

- name: "Debian | Set some variables"
- name: "Debian | Repo URL"
ansible.builtin.set_fact:
zabbix_short_version: "{{ zabbix_agent_version | regex_replace('\\.', '') }}"
zabbix_agent_apt_repository:
- "http://repo.zabbix.com/zabbix/{{ zabbix_agent_version }}/{{ ansible_distribution.lower() }}-arm64/"
- "{{ ansible_distribution_release }}"
- "main"
zabbix_underscore_version: "{{ zabbix_agent_version | regex_replace('\\.', '_') }}"
zabbix_repo_deb_url: "{{ _zabbix_repo_deb_url }}{{ '-arm64' if ansible_machine == 'aarch64' else ''}}"
when:
- ansible_machine == "aarch64"
- zabbix_repo_deb_url is undefined
tags:
- always

Expand Down Expand Up @@ -70,13 +59,20 @@
- install

- name: "Debian | Installing repository {{ ansible_distribution }}"
ansible.builtin.apt_repository:
repo: "{{ item }} [signed-by={{ zabbix_gpg_key }}] {{ zabbix_agent_apt_repository | join(' ') }}"
state: present
ansible.builtin.copy:
dest: /etc/apt/sources.list.d/zabbix.sources
owner: root
group: root
mode: 0644
content: |
Types: deb 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
with_items:
- deb-src
- deb
tags:
- install

Expand Down
1 change: 1 addition & 0 deletions roles/zabbix_agent/vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ zabbix_valid_agent_versions:

debian_keyring_path: /etc/apt/keyrings/
zabbix_gpg_key: "{{ debian_keyring_path }}/zabbix-official-repo.asc"
_zabbix_repo_deb_url: "http://repo.zabbix.com/zabbix/{{ zabbix_agent_version }}/{{ ansible_distribution.lower() }}"
2 changes: 2 additions & 0 deletions roles/zabbix_javagateway/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ zabbix_repo_yum:
gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
state: present

zabbix_repo_deb_component: main

zabbix_javagateway_pidfile: /run/zabbix/zabbix_java_gateway.pid
zabbix_javagateway_listenip: 0.0.0.0
zabbix_javagateway_listenport: 10052
Expand Down
43 changes: 18 additions & 25 deletions roles/zabbix_javagateway/tasks/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,13 @@
tags:
- always

- name: "Debian | Set some variables"
- name: "Debian | Repo URL"
ansible.builtin.set_fact:
zabbix_javagateway_apt_repository:
- "http://repo.zabbix.com/zabbix/{{ zabbix_javagateway_version }}/{{ ansible_distribution.lower() }}/"
- "{{ ansible_distribution_release }}"
- "main"
zabbix_repo_deb_url: "{{ _zabbix_repo_deb_url }}{{ '-arm64' if ansible_machine == 'aarch64' else ''}}"
when:
- ansible_machine != "aarch64"
- zabbix_repo_deb_url is undefined
tags:
- install

- name: "Debian | Set some variables"
ansible.builtin.set_fact:
zabbix_javagateway_apt_repository:
- "http://repo.zabbix.com/zabbix/{{ zabbix_javagateway_version }}/{{ ansible_distribution.lower() }}-arm64/"
- "{{ ansible_distribution_release }}"
- "main"
when:
- ansible_machine == "aarch64"
tags:
- install
- always

# 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.
Expand All @@ -50,14 +36,21 @@
tags:
- install

- name: "Debian | Installing repository Debian"
ansible.builtin.apt_repository:
repo: "{{ item }} [signed-by={{ zabbix_gpg_key }}] {{ zabbix_javagateway_apt_repository | join(' ') }}"
state: present
- 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
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
with_items:
- deb-src
- deb
tags:
- install

Expand Down
1 change: 1 addition & 0 deletions roles/zabbix_javagateway/vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ zabbix_valid_javagateway_versions:

debian_keyring_path: /etc/apt/keyrings/
zabbix_gpg_key: "{{ debian_keyring_path }}/zabbix-official-repo.asc"
_zabbix_repo_deb_url: "http://repo.zabbix.com/zabbix/{{ zabbix_javagateway_version }}/{{ ansible_distribution.lower() }}"
1 change: 1 addition & 0 deletions roles/zabbix_proxy/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ zabbix_proxy_version_minor: "*"
# Yum/APT Variables
zabbix_repo_yum_schema: https
zabbix_repo_yum_gpgcheck: 0
zabbix_repo_deb_component: main
zabbix_proxy_disable_repo:
- epel
zabbix_repo_yum:
Expand Down
29 changes: 22 additions & 7 deletions roles/zabbix_proxy/tasks/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
tags:
- always

- name: "Debian | Repo URL"
ansible.builtin.set_fact:
zabbix_repo_deb_url: "{{ _zabbix_repo_deb_url }}{{ '-arm64' if ansible_machine == 'aarch64' else ''}}"
when:
- zabbix_repo_deb_url is undefined
tags:
- always

- name: "Debian | Set some facts for Zabbix"
ansible.builtin.set_fact:
datafiles_path: /usr/share/doc/zabbix-sql-scripts/{{ zabbix_proxy_db_long }}
Expand Down Expand Up @@ -56,13 +64,20 @@
- install

- name: "Debian | Installing repository {{ ansible_distribution }}"
ansible.builtin.apt_repository:
repo: "{{ item }} [signed-by={{ zabbix_gpg_key }}] http://repo.zabbix.com/zabbix/{{ zabbix_proxy_version }}/{{ ansible_distribution.lower() }}/ {{ ansible_distribution_release }} main"
state: present
ansible.builtin.copy:
dest: /etc/apt/sources.list.d/zabbix.sources
owner: root
group: root
mode: 0644
content: |
Types: deb 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
with_items:
- deb-src
- deb
tags:
- install

Expand Down Expand Up @@ -96,7 +111,7 @@
ansible.builtin.apt:
pkg: "zabbix-proxy-{{ zabbix_proxy_database }}"
update_cache: true
cache_valid_time: 3600
cache_valid_time: 0
force: true
state: "{{ zabbix_proxy_package_state }}"
default_release: "{{ ansible_distribution_release }}"
Expand Down
1 change: 1 addition & 0 deletions roles/zabbix_proxy/vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ mysql_plugin:

debian_keyring_path: /etc/apt/keyrings/
zabbix_gpg_key: "{{ debian_keyring_path }}/zabbix-official-repo.asc"
_zabbix_repo_deb_url: "http://repo.zabbix.com/zabbix/{{ zabbix_proxy_version }}/{{ ansible_distribution.lower() }}"
1 change: 1 addition & 0 deletions roles/zabbix_server/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ zabbix_server_version_minor: "*"
zabbix_server_package_state: present
zabbix_repo_yum_gpgcheck: 0
zabbix_repo_yum_schema: https
zabbix_repo_deb_component: main
zabbix_server_disable_repo:
- epel
zabbix_repo_yum:
Expand Down
37 changes: 16 additions & 21 deletions roles/zabbix_server/tasks/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,16 @@
- name: "Debian | Set some variables"
ansible.builtin.set_fact:
zabbix_short_version: "{{ zabbix_server_version | regex_replace('\\.', '') }}"
zabbix_server_apt_repository:
- "http://repo.zabbix.com/zabbix/{{ zabbix_server_version }}/{{ ansible_distribution.lower() }}/"
- "{{ ansible_distribution_release }}"
- "main"
zabbix_underscore_version: "{{ zabbix_server_version | regex_replace('\\.', '_') }}"
zabbix_python_prefix: "python{% if ansible_python_version is version('3', '>=') %}3{% endif %}"
when:
- ansible_machine != "aarch64"
tags:
- always

- name: "Debian | Set some variables"
- name: "Debian | Repo URL"
ansible.builtin.set_fact:
zabbix_short_version: "{{ zabbix_server_version | regex_replace('\\.', '') }}"
zabbix_server_apt_repository:
- "http://repo.zabbix.com/zabbix/{{ zabbix_server_version }}/{{ ansible_distribution.lower() }}-arm64/"
- "{{ ansible_distribution_release }}"
- "main"
zabbix_underscore_version: "{{ zabbix_server_version | regex_replace('\\.', '_') }}"
zabbix_python_prefix: "python{% if ansible_python_version is version('3', '>=') %}3{% endif %}"
zabbix_repo_deb_url: "{{ _zabbix_repo_deb_url }}{{ '-arm64' if ansible_machine == 'aarch64' else ''}}"
when:
- ansible_machine == "aarch64"
- zabbix_repo_deb_url is undefined
tags:
- always

Expand Down Expand Up @@ -75,13 +63,20 @@
- install

- name: "Debian | Installing repository {{ ansible_distribution }}"
ansible.builtin.apt_repository:
repo: "{{ item }} [signed-by={{ zabbix_gpg_key }}] {{ zabbix_server_apt_repository | join(' ') }}"
state: present
ansible.builtin.copy:
dest: /etc/apt/sources.list.d/zabbix.sources
owner: root
group: root
mode: 0644
content: |
Types: deb 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
with_items:
- deb-src
- deb
tags:
- install

Expand Down
1 change: 1 addition & 0 deletions roles/zabbix_server/vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ zabbix_valid_server_versions:

debian_keyring_path: /etc/apt/keyrings/
zabbix_gpg_key: "{{ debian_keyring_path }}/zabbix-official-repo.asc"
_zabbix_repo_deb_url: "http://repo.zabbix.com/zabbix/{{ zabbix_server_version }}/{{ ansible_distribution.lower() }}"
1 change: 1 addition & 0 deletions roles/zabbix_web/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ zabbix_web_apt_priority:
zabbix_web_version_minor: "*"
zabbix_repo_yum_gpgcheck: 0
zabbix_repo_yum_schema: https
zabbix_repo_deb_component: main
zabbix_web_disable_repo:
- epel
zabbix_repo_yum:
Expand Down
37 changes: 16 additions & 21 deletions roles/zabbix_web/tasks/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,16 @@
- name: "Debian | Set some variables"
ansible.builtin.set_fact:
zabbix_short_version: "{{ zabbix_web_version | regex_replace('\\.', '') }}"
zabbix_web_apt_repository:
- "http://repo.zabbix.com/zabbix/{{ zabbix_web_version }}/{{ ansible_distribution.lower() }}/"
- "{{ ansible_distribution_release }}"
- "main"
zabbix_underscore_version: "{{ zabbix_web_version | regex_replace('\\.', '_') }}"
zabbix_python_prefix: "python{% if ansible_python_version is version('3', '>=') %}3{% endif %}"
when:
- ansible_machine != "aarch64"
tags:
- always

- name: "Debian | Set some variables"
- name: "Debian | Repo URL"
ansible.builtin.set_fact:
zabbix_short_version: "{{ zabbix_web_version | regex_replace('\\.', '') }}"
zabbix_web_apt_repository:
- "http://repo.zabbix.com/zabbix/{{ zabbix_web_version }}/{{ ansible_distribution.lower() }}-arm64/"
- "{{ ansible_distribution_release }}"
- "main"
zabbix_underscore_version: "{{ zabbix_web_version | regex_replace('\\.', '_') }}"
zabbix_python_prefix: "python{% if ansible_python_version is version('3', '>=') %}3{% endif %}"
zabbix_repo_deb_url: "{{ _zabbix_repo_deb_url }}{{ '-arm64' if ansible_machine == 'aarch64' else ''}}"
when:
- ansible_machine == "aarch64"
- zabbix_repo_deb_url is undefined
tags:
- always

Expand Down Expand Up @@ -91,13 +79,20 @@
- install

- name: "Debian | Installing repository {{ ansible_distribution }}"
ansible.builtin.apt_repository:
repo: "{{ item }} [signed-by={{ zabbix_gpg_key }}] {{ zabbix_web_apt_repository | join(' ') }}"
state: present
ansible.builtin.copy:
dest: /etc/apt/sources.list.d/zabbix.sources
owner: root
group: root
mode: 0644
content: |
Types: deb 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
with_items:
- deb-src
- deb
tags:
- install

Expand Down
Loading