--- - debug: msg: - "SSH: {{ monitored_by_ssh }}" - "NRPE: {{ monitored_by_nrpe }}" - name: Sanity checks assert: that: - monitored_dont|default(false) != true - monitored_by_nrpe == true or monitored_by_ssh == true fail_msg: "Neither monitored_by_nrpe nor monitored_by_ssh set to True" - name: Gather OS Specific Variables include_vars: "{{ item }}" with_first_found: - "{{ (ansible_distribution|lower).split(' ')[0] }}-{{ (ansible_distribution_version|lower).split(' ')[0] }}.yml" - "{{ (ansible_distribution|lower).split(' ')[0] }}-{{ (ansible_distribution_major_version|lower).split(' ')[0] }}.yml" - "{{ (ansible_distribution|lower).split(' ')[0] }}.yml" - "{{ (ansible_os_family|lower).split(' ')[0] }}.yml" - name: "Install dependencies" package: name: "{{ monitored_packages_predepends }}" state: latest when: monitored_packages_predepends|default(false) - name: "INCLUDE: Create monitoring user" import_tasks: user.yml - name: "INCLUDE: Install always necessary packages" include_tasks: packages.yml when: monitored_packages_install != false - name: "INCLUDE: Copy custom plugins" include_tasks: plugins_custom.yml when: monitored_plugins_custom|default([]) != [] - name: "INCLUDE: Monitoring by NRPE" include_tasks: nrpe.yml when: monitored_by_nrpe == true - name: "INCLUDE: Monitoring by SSH" include_tasks: ssh.yml when: monitored_by_ssh == true