Created
March 7, 2018 22:11
-
-
Save metabsd/159366db2fed83813c7afd981282cc63 to your computer and use it in GitHub Desktop.
when status == 200 not working.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Monitoring Filebeat Service | |
uri: | |
url: 'https://{{ nagios_server }}/nagiosxi/api/v1/config/service?apikey={{ nagios_api_key }}' | |
body: 'host_name={{ ansible_nodename }}&service_description={{ nagios_service_description }}&use={{ nagios_filebeat_template }}&force=1' | |
status_code: 200 | |
method: POST | |
return_content: yes | |
validate_certs: no | |
timeout: 120 | |
delegate_to: 127.0.0.1 | |
register: monitor_filebeat | |
when: | |
- ansible_nodename not in nagios_xi_services.json.servicelist.service|selectattr('service_description', 'search', nagios_service_description)|list == [] | |
- name: Apply Config on Nagios | |
uri: | |
url: 'https://{{ nagios_server }}/nagiosxi/api/v1/system/applyconfig?apikey={{ nagios_api_key }}' | |
status_code: 200 | |
method: POST | |
return_content: yes | |
validate_certs: no | |
headers: | |
Content-Type: "application/json" | |
timeout: 120 | |
delegate_to: 127.0.0.1 | |
run_once: true | |
when: monitor_filebeat.status == 200 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment