Convert to lowercase true/false

This commit is contained in:
Sven Velt 2024-11-08 11:52:58 +01:00
parent 20cb12a66a
commit fb0c83c738
8 changed files with 23 additions and 18 deletions

View file

@ -12,8 +12,8 @@ Role Variables
--------------
Defaults (config/overwrite required):
- `monitored_by_nrpe` (defaults: `False`): install/configure NRPE
- `monitored_by_ssh` (defaults: `False`): install/configure SSH incl. wrapper
- `monitored_by_nrpe` (defaults: `false`): install/configure NRPE
- `monitored_by_ssh` (defaults: `false`): install/configure SSH incl. wrapper
script
- `monitored_server_ips` (defaults: `[127.0.0.1,]`: list(!) of monitoring server
ips
@ -22,7 +22,7 @@ Required for SSH:
- `monitored_ssh_key_files` (defaults: `[]`): list(!) of SSH key strings(!)
Common variables:
- `monitored_packages_install` (defaults: `True`): install plugings
- `monitored_packages_install` (defaults: `true`): install plugings
- `monitored_sudo_file` (defaults: `/etc/sudoers.d/monitored`): sudoers file
- `monitored_sudo_commands`: list of `sudoers` config lines
- `monitored_packages_additional(_nrpe|_ssh)`: additional packages to install
@ -44,7 +44,7 @@ Example Playbook
- hosts: all
roles:
- role: monitored
when: monitored_dont|default(False) != True
when: monitored_dont|default(false) != true
License
-------

View file

@ -1,6 +1,6 @@
---
monitored_by_nrpe: False
monitored_by_ssh: False
monitored_by_nrpe: false
monitored_by_ssh: false
monitored_user: nagios
monitored_group: nagios
@ -11,7 +11,7 @@ monitored_password: null
monitored_sudo_file: /etc/sudoers.d/monitored
monitored_sudo_commands: []
monitored_packages_install: True
monitored_packages_install: true
monitored_packages_predepends: []
monitored_packages_additional: []
monitored_packages_additional_nrpe: []

View file

@ -7,5 +7,5 @@
# when: ansible_os_family == "RedHat" and ansible_distribution != "Fedora"
- role: monitored
when: monitored_dont|default(False) != True
when: monitored_dont|default(false) != true

View file

@ -1,9 +1,14 @@
---
- 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
- 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
@ -18,14 +23,14 @@
package:
name: "{{ monitored_packages_predepends }}"
state: latest
when: monitored_packages_predepends|default(False)
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
when: monitored_packages_install != false
- name: "INCLUDE: Copy custom plugins"
include_tasks: plugins_custom.yml
@ -33,9 +38,9 @@
- name: "INCLUDE: Monitoring by NRPE"
include_tasks: nrpe.yml
when: monitored_by_nrpe == True
when: monitored_by_nrpe == true
- name: "INCLUDE: Monitoring by SSH"
include_tasks: ssh.yml
when: monitored_by_ssh == True
when: monitored_by_ssh == true

View file

@ -4,7 +4,7 @@
name: "{{ monitored_packages_mp }}"
state: latest
register: monitoringplugins
ignore_errors: True
ignore_errors: true
- name: Install Nagios-Plugins
package:

View file

@ -21,7 +21,7 @@
group: "{{ monitored_group }}"
mode: "{{ monitored_ssh_key_wrapper_mode }}"
backup: yes
when: monitored_ssh_key_wrapper_src|default(False) and monitored_ssh_key_wrapper|default(False)
when: monitored_ssh_key_wrapper_src|default(false) and monitored_ssh_key_wrapper|default(false)
- name: Install additional packages for SSH monitoring
package:

View file

@ -22,5 +22,5 @@ monitored_packages_nrpe:
- nrpe
monitored_nrpe_basedir: /etc
monitored_nrpe_pidfile: False
monitored_nrpe_pidfile: false

View file

@ -1,5 +1,5 @@
---
monitored_by_nrpe: False
monitored_by_nrpe: false
monitored_packages_nrpe: null