From 3a10d3a25feec02b8d8eb8b1fa6c5c883469a634 Mon Sep 17 00:00:00 2001 From: sdarwin Date: Thu, 6 Jul 2023 16:25:17 +0000 Subject: [PATCH] Lint again: ansible-lint 6.17.2 --- defaults/main.yml | 96 ++++++++++----------- handlers/main.yml | 1 + tasks/build-nagios.yml | 12 +-- tasks/build-plugins.yml | 2 +- tasks/client.yml | 1 - tasks/client_freebsd.yml | 8 +- tasks/client_linux.yml | 8 +- tasks/client_macos.yml | 17 ++-- tasks/configs.yml | 16 ++-- tasks/main.yml | 4 +- tasks/nrpe_client.yml | 10 +-- tasks/server.yml | 6 +- tasks/setup-Debian-family-prerequisites.yml | 2 +- vars/Darwin-family.yml | 6 +- vars/FreeBSD-family.yml | 10 +-- vars/RedHat-family.yml | 4 +- 16 files changed, 101 insertions(+), 102 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 99c68c6..0f06f89 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -5,7 +5,7 @@ nrpe_plugin_dir: /usr/lib/nagios/plugins # Directory that will be used as the location for the downloads§ nagios_download_dir: "{{ ansible_env.HOME }}/nagios" -nagios_admins_group: 'sysadmin' +nagios_admins_group: sysadmin # nagios_users_group: 'users' nagios_version: 4.4.9 @@ -13,19 +13,19 @@ nagios_plugins_version: 2.4.4 nrpe_version: 4.0.3 # Define the download url for the Nagios Core source files and the version you want to use. -nagios_url: "https://assets.nagios.com/downloads/nagioscore/releases/nagios-{{ nagios_version }}.tar.gz" +nagios_url: https://assets.nagios.com/downloads/nagioscore/releases/nagios-{{ nagios_version }}.tar.gz # This is the directory where the Nagios source files will be placed, this should be # the directory which is created when the download file is unpacked when runnint # tar -xzvf nagios-4.1.1.tar.gz -nagios_src: "nagios-{{ nagios_version }}" +nagios_src: nagios-{{ nagios_version }} # Define the download url for the Plugins and the version you want to use. -nagios_pluginsurl: "http://www.nagios-plugins.org/download/nagios-plugins-{{ nagios_plugins_version }}.tar.gz" +nagios_pluginsurl: http://www.nagios-plugins.org/download/nagios-plugins-{{ nagios_plugins_version }}.tar.gz # This is the directory where the Plugin source files will be placed, this should be # the directory which is created when the download file is unpacked when runnint # tar -xzvf nagios-plugins-2.1.1.tar.gz -nagios_pluginssrc: "nagios-plugins-{{ nagios_plugins_version }}" +nagios_pluginssrc: nagios-plugins-{{ nagios_plugins_version }} nagios_monitoring_user: nagios nagios_monitoring_command_group: nagcmd @@ -45,8 +45,8 @@ nagios_users: # require the distributions Nagios package to be installed. # nrpe_url: "http://sourceforge.net/projects/nagios/files/nrpe-{{ nrpe_version | regex_replace('(\\d+)\\..*', '\\1') }}.x/nrpe-{{ nrpe_version }}/nrpe-{{ nrpe_version }}.tar.gz" # nrpe_url: "https://downloads.sourceforge.net/project/nagios/nrpe-{{ nrpe_version | regex_replace('(\\d+)\\..*', '\\1') }}.x/nrpe-{{ nrpe_version }}.tar.gz" -nrpe_url: "https://downloads.sourceforge.net/project/nagios/nrpe-{{ nrpe_version | regex_replace('(\\d+)\\..*', '\\1') }}.x//nrpe-{{ nrpe_version }}/nrpe-{{ nrpe_version }}.tar.gz" -nrpe_src: "nrpe-{{ nrpe_version }}" +nrpe_url: https://downloads.sourceforge.net/project/nagios/nrpe-{{ nrpe_version | regex_replace('(\d+)\..*', '\1') }}.x//nrpe-{{ nrpe_version }}/nrpe-{{ nrpe_version }}.tar.gz +nrpe_src: nrpe-{{ nrpe_version }} # Location of monitoring plugins nrpe_client_plugins_dir: /usr/local/nagios/libexec @@ -71,13 +71,13 @@ nagios_group: nagios # define service checks per hostgroup here. Groups themselves are created by the ansible inventory. nagios_host_groups: - - name: 'all' + - name: all checks: - - {command: 'check_ssh', description: 'SSH Service Check'} - - {command: 'check_disk', description: 'Check Disk Space'} + - {command: check_ssh, description: SSH Service Check} + - {command: check_disk, description: Check Disk Space} # - {command: 'check_swap', description: 'Check Swap Space'} - - {command: 'check_load', description: 'Check Load'} - - {command: 'check_mem', description: 'Check Memory'} + - {command: check_load, description: Check Load} + - {command: check_mem, description: Check Memory} # - name: 'webservers' # checks: # - {command: 'check_http', description: 'Check HTTP'} @@ -92,28 +92,28 @@ nagios_hosts: "" nagios_commands: # check_ssh is already in the default installation # - {name: 'check_ssh', command: '$USER1$/check_ssh $ARG1$ $HOSTADDRESS$'} - - {name: 'check_disk', command: '$USER1$/check_nrpe -H $HOSTADDRESS$ -c check_disk'} - - {name: 'check_load', command: '$USER1$/check_nrpe -H $HOSTADDRESS$ -c check_load'} - - {name: 'check_swap', command: '$USER1$/check_nrpe -H $HOSTADDRESS$ -c check_swap'} - - {name: 'check_mem', command: '$USER1$/check_nrpe -H $HOSTADDRESS$ -c check_mem'} - - {name: 'check_https', command: '$USER1$/check_http -f follow -S --verify-host -C 21,14 --continue-after-certificate --sni -I $ARG1$ -H $ARG2$ -s $ARG3$ -u $ARG4$'} - - {name: 'check_https_certonly', command: '$USER1$/check_http -f follow -S --verify-host -C 21,14 --sni -I $ARG1$ -H $ARG2$ -s $ARG3$ -u $ARG4$ -p $ARG5$'} - - {name: 'check_http_full', command: '$USER1$/check_http -f follow --sni -I $ARG1$ -H $ARG2$ -s $ARG3$ -u $ARG4$'} + - {name: check_disk, command: $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_disk} + - {name: check_load, command: $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_load} + - {name: check_swap, command: $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_swap} + - {name: check_mem, command: $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_mem} + - {name: check_https, command: "$USER1$/check_http -f follow -S --verify-host -C 21,14 --continue-after-certificate --sni -I $ARG1$ -H $ARG2$ -s $ARG3$ -u $ARG4$"} + - {name: check_https_certonly, command: "$USER1$/check_http -f follow -S --verify-host -C 21,14 --sni -I $ARG1$ -H $ARG2$ -s $ARG3$ -u $ARG4$ -p $ARG5$"} + - {name: check_http_full, command: $USER1$/check_http -f follow --sni -I $ARG1$ -H $ARG2$ -s $ARG3$ -u $ARG4$} nagios_cgi_show_context_help: 1 -nagios_cgi_authorized_for_system_information: '*' -nagios_cgi_authorized_for_configuration_information: '*' -nagios_cgi_authorized_for_system_commands: '*' -nagios_cgi_authorized_for_all_services: '*' -nagios_cgi_authorized_for_all_hosts: '*' -nagios_cgi_authorized_for_all_service_commands: '*' -nagios_cgi_authorized_for_all_host_commands: '*' +nagios_cgi_authorized_for_system_information: "*" +nagios_cgi_authorized_for_configuration_information: "*" +nagios_cgi_authorized_for_system_commands: "*" +nagios_cgi_authorized_for_all_services: "*" +nagios_cgi_authorized_for_all_hosts: "*" +nagios_cgi_authorized_for_all_service_commands: "*" +nagios_cgi_authorized_for_all_host_commands: "*" nagios_cgi_default_statusmap_layout: 5 nagios_cgi_default_statuswrl_layout: 4 nagios_cgi_result_limit: 100 nagios_cgi_escape_html_tags: 0 -nagios_cgi_action_url_target: '_blank' -nagios_cgi_notes_url_target: '_blank' +nagios_cgi_action_url_target: _blank +nagios_cgi_notes_url_target: _blank nagios_cgi_lock_author_names: 1 nagios_server_name: nagios nagios_conf_dir: "{{ nagios_base_dir }}/etc" @@ -132,17 +132,17 @@ nrpe_checks: critical_condition: "{{ ansible_processor_vcpus * 2 }},{{ ansible_processor_vcpus * 3 / 2 }},{{ ansible_processor_vcpus }}" check_disk: command: "{{ nrpe_plugin_dir }}/check_disk" - warning_condition: '20%' - critical_condition: '10%' - parameters: "-A -i '.gvfs' -i /run/user -i /run/lxcfs -i /run/docker -i /var/lib/docker -i /var/lib/kubelet -i '/snap/*' -i /sys/kernel/debug/tracing" + warning_condition: 20% + critical_condition: 10% + parameters: -A -i '.gvfs' -i /run/user -i /run/lxcfs -i /run/docker -i /var/lib/docker -i /var/lib/kubelet -i '/snap/*' -i /sys/kernel/debug/tracing check_swap: command: "{{ nrpe_plugin_dir }}/check_swap" - warning_condition: '30%' - critical_condition: '20%' + warning_condition: 30% + critical_condition: 20% check_mem: command: "{{ nrpe_plugin_dir }}/check_mem" - warning_condition: '70' - critical_condition: '80' + warning_condition: "70" + critical_condition: "80" nagios_hosts_ignore: "" nagios_groups_ignore: "" @@ -157,7 +157,7 @@ nagios_allowed_hosts: nagios_remove_all_group: "no" # Probably leave this as-is. It should match your top-level ansible playbook, such as "- hosts: monitoring-servers" -nagios_monitoring_servers_group_name: "monitoring-servers" +nagios_monitoring_servers_group_name: monitoring-servers # optionally define more timeperiods. nagios_timeperiods: "" @@ -173,20 +173,20 @@ nagios_timeperiods: "" # saturday: "00:00-06:00,06:15-07:00,07:15-08:00,08:15-24:00" # -nsclient_installed_location: 'C:\\Program Files\\NSClient++' -nsclient_password: 'Pi4j8ZWcUZdecYQu' +nsclient_installed_location: C:\\Program Files\\NSClient++ +nsclient_password: Pi4j8ZWcUZdecYQu # using nagios_allowed_hosts instead of nsclient_allowed_hosts # nsclient_allowed_hosts: '127.0.0.1' -nsclient_ssl_options: 'no-sslv2,no-sslv3' -nsclient_verify_mode: 'none' -nsclient_insecure: 'false' -nsclient_checkexternalscripts: 'enabled' -nsclient_checkhelpers: 'disabled' -nsclient_checkeventlog: 'disabled' -nsclient_checknscp: 'disabled' -nsclient_checkdisk: 'enabled' -nsclient_checksystem: 'enabled' -nsclient_nrpeserver: 'enabled' +nsclient_ssl_options: no-sslv2,no-sslv3 +nsclient_verify_mode: none +nsclient_insecure: "false" +nsclient_checkexternalscripts: enabled +nsclient_checkhelpers: disabled +nsclient_checkeventlog: disabled +nsclient_checknscp: disabled +nsclient_checkdisk: enabled +nsclient_checksystem: enabled +nsclient_nrpeserver: enabled # replace this with new output from 'openssl dhparam -C 2048' # hopefully the standard installer will include the step soon nsclient_nrpe_dh_2048_pem: | diff --git a/handlers/main.yml b/handlers/main.yml index 98381b3..75de6b5 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -21,6 +21,7 @@ state: restarted - name: Restart nrpe osx + changed_when: false ansible.builtin.shell: | /bin/launchctl unload /Library/LaunchDaemons/homebrew.mxcl.nrpe.plist /usr/bin/pkill -f /usr/local/opt/nrpe/bin/nrpe diff --git a/tasks/build-nagios.yml b/tasks/build-nagios.yml index 9b654b2..c9cf926 100644 --- a/tasks/build-nagios.yml +++ b/tasks/build-nagios.yml @@ -1,10 +1,9 @@ --- - - name: GET Nagios ansible.builtin.get_url: url: "{{ nagios_url }}" dest: "{{ nagios_download_dir }}/{{ nagios_src }}.tar.gz" - mode: 0755 + mode: "0755" - name: Unpack Nagios source files ansible.builtin.shell: cd {{ nagios_download_dir }} && tar -xzvf {{ nagios_src }}.tar.gz creates={{ nagios_download_dir }}/{{ nagios_src }} @@ -54,6 +53,7 @@ - name: Make install-init ansible.builtin.shell: cd {{ nagios_download_dir }}/{{ nagios_src }} && make install-init + changed_when: true when: - not init_d_nagios_stat.stat.exists - not nagios_service_stat.stat.exists @@ -70,8 +70,8 @@ line: "{{ item.line }}" insertbefore: "### END INIT INFO" with_items: - - {regexp: '^# Default-Start:\s*2 3 4 5', line: '# Default-Start: 2 3 4 5'} - - {regexp: '^# Default-Stop:\s*0 1 6', line: '# Default-Stop: 0 1 6'} + - {regexp: ^# Default-Start:\s*2 3 4 5, line: "# Default-Start: 2 3 4 5"} + - {regexp: ^# Default-Stop:\s*0 1 6, line: "# Default-Stop: 0 1 6"} when: init_d_nagios_stat_2.stat.exists - name: Set htpasswd for gui users @@ -82,7 +82,7 @@ state: present owner: root group: root - mode: 0644 + mode: "0644" with_items: "{{ nagios_users | default([]) }}" no_log: true @@ -95,7 +95,7 @@ state: present owner: root group: root - mode: 0644 + mode: "0644" when: nagios_admins_group in item.groups with_items: "{{ users | default([]) }}" no_log: true diff --git a/tasks/build-plugins.yml b/tasks/build-plugins.yml index b97accb..a9a2375 100644 --- a/tasks/build-plugins.yml +++ b/tasks/build-plugins.yml @@ -3,7 +3,7 @@ ansible.builtin.get_url: url: "{{ nagios_pluginsurl }}" dest: "{{ nagios_download_dir }}/{{ nagios_pluginssrc }}.tar.gz" - mode: 0755 + mode: "0755" - name: Unpack Plugin source files ansible.builtin.shell: cd {{ nagios_download_dir }} && tar -xzvf {{ nagios_pluginssrc }}.tar.gz creates={{ nagios_download_dir }}/{{ nagios_pluginssrc }} diff --git a/tasks/client.yml b/tasks/client.yml index 8c0072f..d19b876 100644 --- a/tasks/client.yml +++ b/tasks/client.yml @@ -1,5 +1,4 @@ --- - - name: Include linux client ansible.builtin.import_tasks: client_linux.yml when: ansible_system == 'Linux' diff --git a/tasks/client_freebsd.yml b/tasks/client_freebsd.yml index d171ff5..f1a33dd 100644 --- a/tasks/client_freebsd.yml +++ b/tasks/client_freebsd.yml @@ -15,13 +15,13 @@ dest: /usr/local/etc/nrpe.cfg owner: root group: wheel - mode: 0644 + mode: "0644" notify: Restart nrpe - name: Enable nrpe3 in /etc/rc.conf ansible.builtin.lineinfile: path: /etc/rc.conf - regexp: '^nrpe3_enable=' + regexp: ^nrpe3_enable= line: nrpe3_enable="YES" # how to monitor memory on freebsd? @@ -34,7 +34,7 @@ state: directory owner: root group: wheel - mode: 0755 + mode: "0755" - name: NRPE checks ansible.builtin.template: @@ -42,7 +42,7 @@ dest: "{{ nrpe_conf_dir }}/nrpe.d/{{ item.key }}.cfg" owner: root group: wheel - mode: 0644 + mode: "0644" with_dict: "{{ nrpe_checks }}" notify: Restart nrpe diff --git a/tasks/client_linux.yml b/tasks/client_linux.yml index 2b866f6..65974eb 100644 --- a/tasks/client_linux.yml +++ b/tasks/client_linux.yml @@ -81,7 +81,7 @@ ansible.builtin.copy: src: files/check_mem dest: "{{ nrpe_plugin_dir }}/check_mem" - mode: '0755' + mode: "0755" - name: NRPE config file ansible.builtin.template: @@ -89,7 +89,7 @@ dest: /etc/nagios/nrpe.cfg owner: root group: root - mode: 0644 + mode: "0644" notify: Restart nrpe # for redhat @@ -99,7 +99,7 @@ state: directory owner: root group: root - mode: 0755 + mode: "0755" - name: NRPE checks ansible.builtin.template: @@ -107,6 +107,6 @@ dest: "{{ nrpe_conf_dir }}/nrpe.d/{{ item.key }}.cfg" owner: root group: root - mode: 0644 + mode: "0644" with_dict: "{{ nrpe_checks }}" notify: Restart nrpe diff --git a/tasks/client_macos.yml b/tasks/client_macos.yml index 1b60d11..e88c914 100644 --- a/tasks/client_macos.yml +++ b/tasks/client_macos.yml @@ -1,11 +1,11 @@ --- - name: Set fact nagios_mac_install_base ansible.builtin.set_fact: - nagios_mac_install_base: "/usr/local" + nagios_mac_install_base: /usr/local - name: Set fact nagios_mac_install_base arm64 ansible.builtin.set_fact: - nagios_mac_install_base: "/opt/homebrew" + nagios_mac_install_base: /opt/homebrew when: ansible_architecture == "arm64" - name: Ensure nrpe_group exists @@ -16,7 +16,7 @@ - name: Ensure nrpe_user exists ansible.builtin.user: name: "{{ nrpe_user }}" - shell: "/bin/false" + shell: /bin/false groups: "{{ nrpe_group }}" append: true @@ -34,6 +34,7 @@ - name: Install brew ansible.builtin.command: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" when: does_brew_exist.rc + changed_when: true - name: Set fact nrpe_plugin_dir_default ansible.builtin.set_fact: @@ -41,7 +42,7 @@ # Just ran into this problem. A conflict with prometheus. # Might solve it another way in the future. -- name: Fix dir permissions # noqa deprecated-command-syntax +- name: Fix dir permissions # noqa no-free-form ansible.builtin.shell: | chmod g+w {{ nagios_mac_install_base }}/var/log args: @@ -67,7 +68,7 @@ dest: /Library/LaunchDaemons/homebrew.mxcl.nrpe.plist owner: root group: wheel - mode: 0755 + mode: "0755" notify: Restart nrpe osx - name: Remove default LaunchDaemon config @@ -85,7 +86,7 @@ dest: "{{ nagios_mac_install_base }}/etc/nrpe.cfg" owner: administrator group: admin - mode: 0644 + mode: "0644" notify: Restart nrpe osx - name: Create nrpe.d dir @@ -94,7 +95,7 @@ state: directory owner: administrator group: admin - mode: 0755 + mode: "0755" - name: NRPE checks ansible.builtin.template: @@ -102,7 +103,7 @@ dest: "{{ nrpe_conf_dir }}/nrpe.d/{{ item.key }}.cfg" owner: administrator group: admin - mode: 0644 + mode: "0644" with_dict: "{{ nrpe_checks }}" notify: Restart nrpe osx diff --git a/tasks/configs.yml b/tasks/configs.yml index f107faf..40528af 100644 --- a/tasks/configs.yml +++ b/tasks/configs.yml @@ -7,7 +7,7 @@ dest: "{{ nagios_object_dir }}/{{ item.dest }}" owner: "{{ nagios_user }}" group: "{{ nagios_group }}" - mode: '0640' + mode: "0640" with_items: - {src: hosts.cfg, dest: hosts.cfg} - {src: hostgroups.cfg, dest: hostgroups.cfg} @@ -23,7 +23,7 @@ dest: "{{ nagios_object_dir }}/{{ item.dest }}" owner: "{{ nagios_user }}" group: "{{ nagios_group }}" - mode: '0640' + mode: "0640" with_items: - {src: contacts.cfg, dest: contacts.cfg} when: users is defined @@ -36,7 +36,7 @@ dest: "{{ nagios_base_dir }}/etc/{{ item.dest }}" owner: "{{ nagios_user }}" group: "{{ nagios_group }}" - mode: '0775' + mode: "0775" with_items: - {src: cgi.cfg, dest: cgi.cfg} @@ -47,8 +47,8 @@ notify: Restart nagios ansible.builtin.lineinfile: dest: "{{ nagios_base_dir }}/etc/nagios.cfg" - line: "cfg_file={{ nagios_object_dir }}/{{ item }}.cfg" - regexp: "^cfg_file={{ nagios_object_dir }}/{{ item }}.cfg" + line: cfg_file={{ nagios_object_dir }}/{{ item }}.cfg + regexp: ^cfg_file={{ nagios_object_dir }}/{{ item }}.cfg with_items: - hosts - hostgroups @@ -62,8 +62,8 @@ notify: Restart nagios ansible.builtin.lineinfile: dest: "{{ nagios_base_dir }}/etc/nagios.cfg" - line: "cfg_dir={{ nagios_object_dir }}" - regexp: "^cfg_dir={{ nagios_object_dir }}" + line: cfg_dir={{ nagios_object_dir }} + regexp: ^cfg_dir={{ nagios_object_dir }} when: nagios_cfg_dir_enabled # if there is a conflict: two localhost definitions @@ -74,7 +74,7 @@ path: "{{ nagios_base_dir }}/etc/nagios.cfg" line: "#cfg_file={{ nagios_object_dir }}/{{ item }}.cfg" # regexp: "^cfg_file\={{ nagios_object_dir }}/{{item}}\.cfg" - regexp: "^cfg_file={{ nagios_object_dir }}/{{ item }}.cfg" + regexp: ^cfg_file={{ nagios_object_dir }}/{{ item }}.cfg backrefs: true with_items: - localhost diff --git a/tasks/main.yml b/tasks/main.yml index a91b50e..7fe4462 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -13,8 +13,7 @@ when: - item is match("^default_") - vars[item[8:]] is not defined - with_items: - "{{ vars | list }}" + with_items: "{{ vars | list }}" ########## @@ -22,7 +21,6 @@ ansible.builtin.import_tasks: client.yml when: run_nagios_client is defined - - name: Include server ansible.builtin.import_tasks: server.yml when: run_nagios_server is defined diff --git a/tasks/nrpe_client.yml b/tasks/nrpe_client.yml index 8aabb89..4658681 100644 --- a/tasks/nrpe_client.yml +++ b/tasks/nrpe_client.yml @@ -16,7 +16,7 @@ ansible.builtin.copy: src: "{{ nrpe_plugin_dir }}/check_nrpe" dest: "{{ nrpe_client_plugins_dir }}/check_nrpe" - mode: '0755' + mode: "0755" owner: "{{ nagios_user }}" group: "{{ nagios_group }}" remote_src: true @@ -30,7 +30,7 @@ path: "{{ nagios_download_dir }}" owner: root group: root - mode: 0755 + mode: "0755" state: directory - name: Include OS-specific variables. @@ -49,7 +49,7 @@ timeout: 30 url: "{{ nrpe_url }}" dest: "{{ nagios_download_dir }}/{{ nrpe_src }}.tar.gz" - mode: 0755 + mode: "0755" retries: 3 delay: 40 register: result @@ -73,13 +73,13 @@ state: directory owner: root group: root - mode: 0755 + mode: "0755" - name: Copy check_nrpe ansible.builtin.copy: src: "{{ nagios_download_dir }}/{{ nrpe_src }}/src/check_nrpe" dest: "{{ nrpe_client_plugins_dir }}/check_nrpe" - mode: '0755' + mode: "0755" owner: "{{ nagios_user }}" group: "{{ nagios_group }}" remote_src: true diff --git a/tasks/server.yml b/tasks/server.yml index 451123a..c5611bb 100644 --- a/tasks/server.yml +++ b/tasks/server.yml @@ -6,7 +6,7 @@ path: "{{ nagios_download_dir }}" owner: root group: root - mode: 0755 + mode: "0755" state: directory - name: Import setup-RedHat-family-prerequisites.yml @@ -99,7 +99,7 @@ - name: Store selinux mode in current_selinux_mode variable ansible.builtin.set_fact: - current_selinux_mode: '{{ ansible_selinux.mode }}' + current_selinux_mode: "{{ ansible_selinux.mode }}" when: check_selinux - name: Check if SELinux is running in enforcing mode and change access @@ -110,7 +110,7 @@ recurse: true owner: root group: root - mode: 0755 + mode: "0755" when: current_selinux_mode == 'enforcing' - name: Http service state diff --git a/tasks/setup-Debian-family-prerequisites.yml b/tasks/setup-Debian-family-prerequisites.yml index 84f613d..1ddff37 100644 --- a/tasks/setup-Debian-family-prerequisites.yml +++ b/tasks/setup-Debian-family-prerequisites.yml @@ -17,7 +17,7 @@ # not supported on 16.04 - name: Install Plugin prerequisites for Ubuntu ansible.builtin.apt: - name: ['libradiusclient-ng-dev'] + name: [libradiusclient-ng-dev] when: ansible_distribution == 'Ubuntu' and ( ansible_distribution_version == '12.04' or ansible_distribution_version == '14.04' ) - name: Install NRPE prerequisites diff --git a/vars/Darwin-family.yml b/vars/Darwin-family.yml index d797e94..edbd2c1 100644 --- a/vars/Darwin-family.yml +++ b/vars/Darwin-family.yml @@ -14,6 +14,6 @@ nrpe_command_timeout: 60 nrpe_checks: check_disk: command: "{{ nrpe_plugin_dir }}/check_disk" - warning_condition: '20%' - critical_condition: '10%' - parameters: "/" + warning_condition: 20% + critical_condition: 10% + parameters: / diff --git a/vars/FreeBSD-family.yml b/vars/FreeBSD-family.yml index b75e217..21fb637 100644 --- a/vars/FreeBSD-family.yml +++ b/vars/FreeBSD-family.yml @@ -17,13 +17,13 @@ nrpe_checks: critical_condition: "{{ ansible_processor_count | int * 2 }},{{ ansible_processor_count | int * 3 / 2 }},{{ ansible_processor_count | int }}" check_disk: command: "{{ nrpe_plugin_dir }}/check_disk" - warning_condition: '20%' - critical_condition: '10%' - parameters: "-p /" + warning_condition: 20% + critical_condition: 10% + parameters: -p / check_swap: command: "{{ nrpe_plugin_dir }}/check_swap" - warning_condition: '30%' - critical_condition: '20%' + warning_condition: 30% + critical_condition: 20% # check_mem: # command: "{{ nrpe_plugin_dir }}/check_mem" # warning_condition: '70' diff --git a/vars/RedHat-family.yml b/vars/RedHat-family.yml index f40a9cb..f90660a 100644 --- a/vars/RedHat-family.yml +++ b/vars/RedHat-family.yml @@ -30,8 +30,8 @@ epel_release: # epel_repo_url: "http://download.fedoraproject.org/pub/epel/{{ ansible_distribution_major_version }}/ # {{ ansible_userspace_architecture }}{{ '/' if ansible_distribution_major_version|int < 7 else '/e/' }} # epel-release-{{ ansible_distribution_major_version }}-{{ epel_release[ansible_distribution_major_version] }}.noarch.rpm" -epel_repo_url: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm" -epel_repo_gpg_key_path: "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}" +epel_repo_url: https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm +epel_repo_gpg_key_path: /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }} default_nagios_plugin_packages: - openssl-devel