allow instance_name and inventory_hostname

This commit is contained in:
2021-05-07 20:12:43 +12:00
parent 094cce6b01
commit 067b64947c
2 changed files with 9 additions and 3 deletions

View File

@@ -11,12 +11,18 @@
manager: "auto" manager: "auto"
- name: Install check-mk-agent - name: Install check-mk-agent
block: block:
- name: Check if check-mk-agent is present on server
stat:
path: /tmp/check-mk-agent.rpm
register: cmkrpm
- name: Download the agent from Server - name: Download the agent from Server
get_url: get_url:
url: "{{ cmk_rpm_agent }}{{ cmk_auth }}" url: "{{ cmk_rpm_agent }}{{ cmk_auth }}"
dest: /tmp/check-mk-agent.rpm dest: /tmp/check-mk-agent.rpm
validate_certs: false validate_certs: false
when: not cmkrpm.stat.exists
- name: Ensure check_mk_agent installed - name: Ensure check_mk_agent installed
command: /usr/bin/yum install --nogpgcheck -y /tmp/check-mk-agent.rpm command: /usr/bin/yum install --nogpgcheck -y /tmp/check-mk-agent.rpm

View File

@@ -11,7 +11,7 @@
"ipaddress": "{{ ansible_host }}" "ipaddress": "{{ ansible_host }}"
}, },
"folder": "{{ cmk_folder | default('Unsorted') }}", "folder": "{{ cmk_folder | default('Unsorted') }}",
"hostname": "{{ inventory_hostname }}" "hostname": "{{ instance_name | default(inventory_hostname) }}"
} }
body_format: raw body_format: raw
return_content: yes return_content: yes
@@ -33,7 +33,7 @@
uri: uri:
method: POST method: POST
url: "{{ cmk_omd_protocol }}://{{ 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":"{{ instance_name | default(inventory_hostname) }}"}'
body_format: raw body_format: raw
status_code: 200 status_code: 200
validate_certs: no validate_certs: no