- name: Gather installed package facts package_facts: manager: auto - name: Check if nagios NRPE is installed debug: msg: "NRPE is installed." when: "'nagios-nrpe' in ansible_facts.packages" - name: Ensure NRPE is installed (Debian/Ubuntu) apt: name: nrpe state: present become: yes - name: Deploy custom Nagios/NRPE script ansible.builtin.copy: src: memory_usage_check.py dest: /usr/local/nagios/libexec/my_custom_check.py mode: '0755'