--- - name: nrpe | apt update cache apt: update_cache: yes cache_valid_time: 86400 #One day - name: nrpe | install nrpe packages apt: name: "{{ item }}" update_cache: true state: present with_items: - nagios-nrpe-server - monitoring-plugins - monitoring-plugins-basic - monitoring-plugins-common - monitoring-plugins-standard - libmonitoring-plugin-perl - name: nrpe | copy nrpe configuration template: src: "nrpe.j2" dest: "/etc/nagios/nrpe.d/brainsys.cfg" mode: "0644" force: yes backup: yes notify: - restart nagios-nrpe-server - name: nrpe | copy nrpe plugins copy: src: nrpe/ dest: /usr/lib/nagios/plugins mode: 0755 - name: nrpe | restart nagios-nrpe-server systemd: state: restarted name: nagios-nrpe-server - name: nrpe | allow nagios user to specific sudo template: src: nrpe.sudoers.j2 dest: /etc/sudoers.d/nrpe validate: 'visudo -cf %s' mode: 0440