feat: move prereq to dedicated role

This commit is contained in:
Simon Cornet 2025-06-06 17:10:18 +02:00
commit 75226a9c78
5 changed files with 3 additions and 87 deletions

View file

@ -3,15 +3,10 @@
# load variables and collect version information
- name: "include vars and collect versions"
tags:
- "zabbix_agent_prereq"
- "zabbix_agent_install"
- "zabbix_agent_config"
block:
# load os specific variables
- name: "include os specific vars"
ansible.builtin.include_vars: "{{ ansible_os_family }}.yaml"
# collect zabbix-agent2 version information
- name: "collect version information"
ansible.builtin.shell:
@ -22,13 +17,6 @@
register: "zabbix_current_version"
# zabbix-agent prerequisites
- name: "zabbix-agent prerequisites"
ansible.builtin.import_tasks: "prerequisites.yaml"
tags:
- "zabbix_agent_prereq"
# zabbix-agent install
- name: "zabbix-agent install"
ansible.builtin.import_tasks: "install.yaml"

View file

@ -1,52 +0,0 @@
---
# install repository
- name: "install repository"
when: "zabbix_major_version not in zabbix_current_version.stdout"
block:
# install repository - debian
- name: "install repository"
when: 'ansible_os_family == "Debian"'
block:
- name: "remove old zabbix-release"
ansible.builtin.apt:
name: "zabbix-release"
state: "absent"
purge: true
- name: "install zabbix-release"
ansible.builtin.apt:
deb: "{{ zabbix_repo_url[ansible_distribution][ansible_distribution_major_version | int] }}"
state: "present"
force: true
- name: "refresh apt cache"
ansible.builtin.apt:
update_cache: true
# install repository - suse
- name: "install repository"
when: 'ansible_os_family == "Suse"'
block:
- name: "remove old zabbix-release"
ansible.builtin.zypper:
name: "zabbix-release"
state: "absent"
- name: "install zabbix-release"
ansible.builtin.zypper:
name: "{{ zabbix_repo_url[ansible_distribution_major_version | int] }}"
state: "present"
disable_recommends: false
nosignature: true
validate_certs: true
- name: "import gpg key"
community.general.zypper_repository:
name: "Zabbix Official Repository"
auto_import_keys: true
runrefresh: true