collection of ansible roles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

26 lines
964 B

- name: add host to icinga
uri:
url: "{{ icinga2_api_url }}/v1/objects/hosts/{{ ansible_fqdn }}"
method: PUT
return_content: yes
headers:
Accept: application/json
body_format: json
body: '{ "templates": [ "linux" ], "attrs": { "address": "{{ ansible_fqdn }}" }, "pretty": true }'
validate_certs: no
url_username: "{{ icinga2_monitoring_master.api_user }}"
url_password: "{{ icinga2_monitoring_master.api_password }}"
failed_when: false
- name: update host information in icinga
uri:
url: "{{ icinga2_api_url }}/v1/objects/hosts/{{ ansible_fqdn }}"
method: POST
return_content: yes
headers:
Accept: application/json
body_format: json
body: '{ "templates": [ "linux" ], "attrs": { "address": "{{ ansible_fqdn }}" }, "pretty": true }'
validate_certs: no
url_username: "{{ icinga2_monitoring_master.api_user }}"
url_password: "{{ icinga2_monitoring_master.api_password }}"