diff --git a/roles/zabbix_agent/tasks/facts.yml b/roles/zabbix_agent/tasks/facts.yml new file mode 100644 index 0000000..9938ac1 --- /dev/null +++ b/roles/zabbix_agent/tasks/facts.yml @@ -0,0 +1,8 @@ +--- + +- include_vars: "{{ item }}" + with_first_found: + - vars/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml + - vars/{{ ansible_distribution }}.yml + - vars/{{ ansible_os_family }}.yml + tags: zabbix diff --git a/roles/zabbix_agent/tasks/install_Debian.yml b/roles/zabbix_agent/tasks/install_Debian.yml index 9854e16..ee5e04a 100644 --- a/roles/zabbix_agent/tasks/install_Debian.yml +++ b/roles/zabbix_agent/tasks/install_Debian.yml @@ -2,17 +2,7 @@ - name: Install agent and dependencies apt: - name: - - zabbix-agent - - openssl - - git - - libconfig-simple-perl - - libjson-perl - - libfile-which-perl - - smartmontools - - lm-sensors - - patch - - fping + name: "{{ zabbix_agent_packages }}" state: "{{ zabbix_agent_update | ternary('latest','present') }}" policy_rc_d: 101 # Prevent the daemon from starting automatically after install tags: zabbix diff --git a/roles/zabbix_agent/tasks/install_RedHat.yml b/roles/zabbix_agent/tasks/install_RedHat.yml index 68e9017..ac03659 100644 --- a/roles/zabbix_agent/tasks/install_RedHat.yml +++ b/roles/zabbix_agent/tasks/install_RedHat.yml @@ -11,10 +11,7 @@ - name: Install Zabbix Agent and additional scripts yum: - name: - - zabbix-agent - - zabbix-agent-addons - - openssl + name: "{{ zabbix_agent_packages }}" state: "{{ zabbix_agent_update | ternary('latest','present') }}" notify: restart zabbix-agent tags: zabbix diff --git a/roles/zabbix_agent/tasks/main.yml b/roles/zabbix_agent/tasks/main.yml index 1a8e23a..2c03615 100644 --- a/roles/zabbix_agent/tasks/main.yml +++ b/roles/zabbix_agent/tasks/main.yml @@ -1,5 +1,6 @@ --- +- include: facts.yml - include: install_{{ ansible_os_family }}.yml - include: selinux.yml when: ansible_selinux.status == 'enabled' diff --git a/roles/zabbix_agent/vars/CentOS-7.yml b/roles/zabbix_agent/vars/CentOS-7.yml new file mode 100644 index 0000000..03b9f60 --- /dev/null +++ b/roles/zabbix_agent/vars/CentOS-7.yml @@ -0,0 +1,7 @@ +--- + +zabbix_agent_packages: + - zabbix-agent + - zabbix-agent-addons + - policycoreutils-python + - openssl diff --git a/roles/zabbix_agent/vars/CentOS-8.yml b/roles/zabbix_agent/vars/CentOS-8.yml new file mode 100644 index 0000000..71726b6 --- /dev/null +++ b/roles/zabbix_agent/vars/CentOS-8.yml @@ -0,0 +1,8 @@ +--- + +zabbix_agent_packages: + - zabbix-agent + - zabbix-agent-addons + - policycoreutils-python-utils + - openssl + diff --git a/roles/zabbix_agent/vars/Debian-10.yml b/roles/zabbix_agent/vars/Debian-10.yml new file mode 100644 index 0000000..7bf41c0 --- /dev/null +++ b/roles/zabbix_agent/vars/Debian-10.yml @@ -0,0 +1,13 @@ +--- + +zabbix_agent_packages: + - zabbix-agent + - openssl + - git + - libconfig-simple-perl + - libjson-perl + - libfile-which-perl + - smartmontools + - lm-sensors + - patch + - fping diff --git a/roles/zabbix_agent/vars/Debian-8.yml b/roles/zabbix_agent/vars/Debian-8.yml new file mode 100644 index 0000000..7bf41c0 --- /dev/null +++ b/roles/zabbix_agent/vars/Debian-8.yml @@ -0,0 +1,13 @@ +--- + +zabbix_agent_packages: + - zabbix-agent + - openssl + - git + - libconfig-simple-perl + - libjson-perl + - libfile-which-perl + - smartmontools + - lm-sensors + - patch + - fping diff --git a/roles/zabbix_agent/vars/Debian-9.yml b/roles/zabbix_agent/vars/Debian-9.yml new file mode 100644 index 0000000..7bf41c0 --- /dev/null +++ b/roles/zabbix_agent/vars/Debian-9.yml @@ -0,0 +1,13 @@ +--- + +zabbix_agent_packages: + - zabbix-agent + - openssl + - git + - libconfig-simple-perl + - libjson-perl + - libfile-which-perl + - smartmontools + - lm-sensors + - patch + - fping