Add protocol fror host-management

This commit is contained in:
2020-10-14 22:57:15 +13:00
parent 396d711be9
commit fbac11b098
2 changed files with 4 additions and 7 deletions

View File

@@ -1,5 +1,6 @@
--- ---
cmk_add_host: false # Should be true/false whether we should automatically add host for monitoring. cmk_add_host: false # Should be true/false whether we should automatically add host for monitoring.
cmk_omd_protocol: http # Should be http or https
cmk_omd_host: your-checkmk-hostname cmk_omd_host: your-checkmk-hostname
cmk_omd_site: your-checkmk-site # e.g the first piece after the / following your hostname cmk_omd_site: your-checkmk-site # e.g the first piece after the / following your hostname
# If you have created a folder in WATO already you want hosts to be put in when registered # If you have created a folder in WATO already you want hosts to be put in when registered

View File

@@ -2,7 +2,7 @@
- name: add host to omd - name: add host to omd
uri: uri:
method: POST method: POST
url: "http://{{ cmk_omd_host }}/{{ cmk_omd_site }}/check_mk/webapi.py?action=add_host{{ cmk_auth }}" url: "{{ cmk_omd_protocol }}://{{ cmk_omd_host }}/{{ cmk_omd_site }}/check_mk/webapi.py?action=add_host{{ cmk_auth }}"
body: | body: |
request={ request={
"attributes": { "attributes": {
@@ -25,14 +25,10 @@
output: "{{ res.content | from_json }}" output: "{{ res.content | from_json }}"
when: cmk_add_host when: cmk_add_host
# - debug:
# msg: "{{ output }}"
# when: cmk_add_host
- name: cmk_discovery - name: cmk_discovery
uri: uri:
method: POST method: POST
url: http://{{ cmk_omd_host }}/{{ cmk_omd_site }}/check_mk/webapi.py?action=discover_services&mode=refresh{{ cmk_auth }} url: "{{ cmk_omd_protocol }}://{{ cmk_omd_host }}/{{ cmk_omd_site }}/check_mk/webapi.py?action=discover_services&mode=refresh{{ cmk_auth }}"
body: 'request={"hostname":"{{ inventory_hostname }}"}' body: 'request={"hostname":"{{ inventory_hostname }}"}'
body_format: raw body_format: raw
status_code: 200 status_code: 200
@@ -43,7 +39,7 @@
- name: cmk_apply - name: cmk_apply
uri: uri:
method: POST method: POST
url: http://{{ cmk_omd_host }}/{{ cmk_omd_site }}/check_mk/webapi.py?action=activate_changes&mode=specific{{ cmk_auth }} url: "{{ cmk_omd_protocol }}://{{ cmk_omd_host }}/{{ cmk_omd_site }}/check_mk/webapi.py?action=activate_changes&mode=specific{{ cmk_auth }}"
body: 'request={"sites":["{{ cmk_omd_site }}"]}' body: 'request={"sites":["{{ cmk_omd_site }}"]}'
body_format: raw body_format: raw
status_code: 200 status_code: 200