Skip to content

Instantly share code, notes, and snippets.

View metabsd's full-sized avatar
🏠
Working from home

Benoit Martin metabsd

🏠
Working from home
View GitHub Profile
tasks:
- name: add a new disk on guest vm
vmware_guest:
hostname: "{{ vcenter_hostname }}"
user: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ vcenter_datacenter }}"
cluster: "{{ vcenter_cluster }}"
guest_id: "rhel7_64Guest"
validate_certs: False
@metabsd
metabsd / gist:159366db2fed83813c7afd981282cc63
Created March 7, 2018 22:11
when status == 200 not working.
- 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
@metabsd
metabsd / gist:ba83bf0f54a50398c0996eb02b52c750
Created March 7, 2018 19:53
Need help with Ansible and conditionnal from uri module.
Ansible JMESPATH / JSON Explorer
nagios_xi_services.json.servicelist.service[?service_description=='Service Status: Filebeat'].host_name
I want to run a task when the result is empty only.
Example of data I register by module uri in nagios_xi_services
{
"nagios_xi_services": {