all type of installers
This commit is contained in:
@@ -2,24 +2,34 @@
|
|||||||
package_facts:
|
package_facts:
|
||||||
manager: auto
|
manager: auto
|
||||||
|
|
||||||
# , nrpe, nagios-nrpe-plugin
|
- name: Debug OS family fact
|
||||||
- name: Check OS
|
|
||||||
debug:
|
debug:
|
||||||
msg: "{{ ansible_facts['os_family'] }} is the OS"
|
msg: "{{ ansible_facts['os_family'] }} is the OS"
|
||||||
|
|
||||||
|
- name: Set NRPE package name
|
||||||
|
set_fact:
|
||||||
|
nrpe_package: >
|
||||||
|
{% if ansible_facts['os_family'] == 'Debian' %}
|
||||||
|
nagios-nrpe-plugin
|
||||||
|
{% elif ansible_facts['os_family'] == 'RedHat' %}
|
||||||
|
nagios-plugins-nrpe.x86_64
|
||||||
|
{% else %}
|
||||||
|
nrpe
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
- name: Check if nagios NRPE is installed
|
- name: Check if nagios NRPE is installed
|
||||||
debug:
|
debug:
|
||||||
msg: "NRPE is installed."
|
msg: "NRPE is installed."
|
||||||
when: "'nrpe' in ansible_facts.packages"
|
when: "{{ nrpe_package }} in ansible_facts.packages"
|
||||||
|
|
||||||
- name: Ensure NRPE is installed (Debian/Ubuntu)
|
- name: Ensure NRPE is installed (Debian/Ubuntu)
|
||||||
apt:
|
apt:
|
||||||
name: nagios-nrpe-plugin
|
name: nagios-nrpe-plugin
|
||||||
state: present
|
state: present
|
||||||
become: yes
|
become: true
|
||||||
register: nrpe_install_result
|
register: nrpe_install_result
|
||||||
when: "{{ ansible_facts['os_family'] == 'Debian' }} and ('nagios-nrpe-plugin' not in ansible_facts.packages) "
|
when: "{{ ansible_facts['os_family'] }} == 'Debian' and ('{{ nrpe_package }}' not in ansible_facts.packages) "
|
||||||
|
|
||||||
- name: Ensure NRPE is installed (RedHat/CentOS)
|
- name: Ensure NRPE is installed (RedHat/CentOS)
|
||||||
yum:
|
yum:
|
||||||
@@ -27,10 +37,17 @@
|
|||||||
state: present
|
state: present
|
||||||
become: yes
|
become: yes
|
||||||
register: nrpe_install_result
|
register: nrpe_install_result
|
||||||
when: "{{ ansible_facts['os_family'] == 'RedHat' }} and ('nagios-plugins-nrpe.x86_64 ' not in ansible_facts.packages) "
|
when: "{{ ansible_facts['os_family'] }} == 'RedHat' and ('{{ nrpe_package }}' not in ansible_facts.packages) "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- name: Ensure NRPE is installed (FreeBSD)
|
||||||
|
ansible.builtin.pkg:
|
||||||
|
name: "{{ nrpe_package }}"
|
||||||
|
state: present
|
||||||
|
become: yes
|
||||||
|
register: nrpe_install_result
|
||||||
|
when:
|
||||||
|
- ansible_facts['os_family'] == 'FreeBSD'
|
||||||
|
- not nrpe_installed
|
||||||
|
|
||||||
- name: Deploy custom Nagios/NRPE script
|
- name: Deploy custom Nagios/NRPE script
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
|
|||||||
Reference in New Issue
Block a user