Fix up config to be a little more strict

parent df0fcabc
Pipeline #32450 failed with stage
in 5 minutes and 9 seconds
......@@ -7,7 +7,7 @@ nagios_nrpe_agent_service_enabled: true
# in this role per-distro/release
nagios_nrpe_agent_packages: []
nagios_nrpe_agent_config_path: /etc/nrpe.d
nagios_nrpe_agent_config_path: /etc/nagios
# Relative paths will be placed under nagios_nrpe_agent_config_path
# and absolute paths will be placed in the absolute path location
nagios_nrpe_agent_config_file_dest: nrpe.cfg
......@@ -128,9 +128,9 @@ nagios_nrpe_agent_config:
# - name: check_asterisk_peers
# command: /usr/lib64/nagios/plugins/nagisk.pl -c peers
# - name: check_asterisk_channels
# command: /usr/lib64/nagios/plugins/nagisk.pl -c channels
# command: /usr/lib64/nagios/plugins/nagisk.pl -c channels
# - name: check_asterisk_zaptel
# command: /usr/lib64/nagios/plugins/nagisk.pl -c zaptel
# command: /usr/lib64/nagios/plugins/nagisk.pl -c zaptel
# - name: check_asterisk_span
# command: /usr/lib64/nagios/plugins/nagisk.pl -c span -s 1
......
......@@ -37,13 +37,12 @@
- name: Install nrpe config template
template:
src: "etc/nagios/nrpe.cfg.j2"
dest: >
dest: >-
{{ nagios_nrpe_agent_config_file_dest.startswith('/') |
ternary(
nagios_nrpe_agent_config_file_dest,
nagios_nrpe_agent_config_path + "/" + nagios_nrpe_agent_config_file_dest
)
}}
) -}}
owner: "{{ nagios_nrpe_agent_config.nrpe_user | default('root') }}"
group: "{{ nagios_nrpe_agent_config.nrpe_group | default('root') }}"
mode: "0644"
......
# {{ ansible_managed }}
{% for k in nagios_nrpe_agent_config %}
{%- if (nagios_nrpe_agent_config[k] is iterable) and
(nagios_nrpe_agent_config[k] is not string) %}
{{ k }}={{ nagios_nrpe_agent_config[k] | join(', ') }}
{%- elif nagios_nrpe_agent_config[k] is not none %}
{{ k }}={{ nagios_nrpe_agent_config[k] }}
{%- endif %}
{% for k in ['log_facility', 'log_file', 'debug', 'pid_file', 'server_port'
'server_address', 'listen_queue_size', 'nrpe_user', 'nrpe_group'
'allowed_hosts', 'dont_blame_nrpe', 'allow_bash_command_substitutions'
'command_prefix', 'command_timeout', 'connection_timeout'
'allow_weak_random_seed', 'ssl_version', 'ssl_use_adh', 'ssl_cipher_list'
'ssl_cacert_file', 'ssl_cert_file', 'ssl_privatekey_file',
'ssl_client_certs', 'ssl_logging', 'nasty_metachars', 'disable_syslog',
'include', 'include_dir'] %}
{% if (k in nagios_nrpe_agent_config) and
(nagios_nrpe_agent_config[k] is not none) and
(nagios_nrpe_agent_config[k]|string|length > 0) %}
{{ k }} = {{ nagios_nrpe_agent_config[k] }}
{% endif %}
{% endfor %}
{% for k in ['allowed_hosts', 'keep_end_vars'] %}
{% if (k in nagios_nrpe_agent_config) and
(nagios_nrpe_agent_config[k]|length > 0) %}
{{ k }} = {{ nagios_nrpe_agent_config[k] | join(', ') }}
{% endif %}
{% endfor %}
{% if 'commands' in nagios_nrpe_agent_config %}
{% for cmd in nagios_nrpe_agent_config['commands'] %}
command[{{ cmd.name }}] = {{ cmd.command }}
{% endfor %}
{% endif %}
# vim: ts=4 sw=4 expandtab
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment