50
50
dest: /srv/conn-check/config.yaml
51
51
when: "relations['conn-check'] and 'config' in relations['conn-check'][0]"
53
- name: Check if nagios user exists
55
- conn-check-relation-changed
57
action: shell /usr/bin/getent passwd nagios | /usr/bin/wc -l | tr -d ' '
61
53
- name: Write nagios check command config.
63
56
- conn-check-relation-changed
57
- nrpe-external-master-relation-changed
66
59
content: "command[conn_check]=/usr/local/bin/conn-check {{ config_path }}"
67
60
dest: "/etc/nagios/nrpe.d/check_conn_check.cfg"
71
when: user_exist.stdout != "0" and relations['conn-check'] and 'config' in relations['conn-check'][0]
64
when: relations['nrpe-external-master'] and relations['conn-check'] and 'config' in relations['conn-check'][0]
73
66
- name: Write nagios check service definition for export.
75
69
- conn-check-relation-changed
70
- nrpe-external-master-relation-changed
78
72
src: "templates/conn_check_service_export.cfg.jinja2"
79
dest: "/var/lib/nagios/export/service__{{ nagios_context }}-{{ local_unit|replace('/', '-') }}_conn_check.cfg"
73
dest: "/var/lib/nagios/export/service__{{ relations['conn-check'][0].__unit__|replace('/', '-') }}_conn_check.cfg"
83
when: user_exist.stdout != "0" and relations['conn-check'] and 'config' in relations['conn-check'][0]
77
when: relations['nrpe-external-master'] and relations['conn-check'] and 'config' in relations['conn-check'][0]
87
81
shell: /usr/local/bin/conn-check {{ config_path }}
82
when: relations['nrpe-external-master'] and relations['conn-check'] and 'config' in relations['conn-check'][0]