--- - name: install nrpe packages (debian) apt: name: - nagios-nrpe-server - nagios-nrpe-plugin state: present update_cache: yes when: ansible_distribution == 'Debian' - name: install nrpe packages (alpine) apk: name: - nagios-plugins-disk - nagios-plugins-load - nagios-plugins-ntp - nagios-plugins-procs - nagios-plugins-users - nrpe state: present update_cache: yes when: ansible_distribution == 'Alpine' - name: configure nrpe template: src: nrpe.cfg.j2 dest: /etc/nrpe.cfg notify: - reload nrpe when: ansible_distribution == 'Alpine' - name: configure nrpe template: src: nrpe.cfg.j2 dest: /etc/nagios/nrpe.cfg notify: - reload nagios-nrpe-server when: ansible_distribution == 'Debian' - name: ensure nrpe is running service: name: nrpe enabled: yes state: started when: ansible_distribution == 'Alpine' tags: - pkg - name: register the new host on nagios template: src: server.cfg.j2 dest: "/etc/nagios/servers/{{ inventory_hostname_short }}.cfg" delegate_to: "{{ item }}" with_items: "{{ groups['nagios_hosts'] }}" notify: - restart nagios-server