fix: Revert changes to use local_action 🐛
Some checks failed
CI / lint (push) Successful in 2m1s
CI / Molecule Test (almalinux8) (push) Failing after 13s
CI / Molecule Test (almalinux9) (push) Failing after 18s
CI / release (push) Has been skipped
CI / notify (push) Has been skipped

This commit is contained in:
2025-02-21 21:35:36 +13:00
parent c5fe670e43
commit c29898b542
2 changed files with 21 additions and 21 deletions

View File

@@ -1,7 +1,6 @@
---
- name: add host to omd (new)
local_action:
module: uri
uri:
method: POST
headers:
Authorization: Bearer {{ cmk_username }} {{ cmk_secret }}
@@ -19,6 +18,7 @@
status_code: [200, 400]
register: res_add
become: false
delegate_to: localhost
when: >
cmk_add_host and cmk_major | int >= 2 and cmk_minor | int >= 2
@@ -28,19 +28,19 @@
when: cmk_add_host
- name: Host exists fetch etag (new) # noqa command-instead-of-module
local_action:
module: shell
cmd: |
curl \
-G \
-i \
--request GET \
--write-out "\nxxx-status_code=%{http_code}\n" \
--header "Authorization: Bearer {{ cmk_username }} {{ cmk_secret }}" \
--header "Accept: application/json" \
"{{ cmk_omd_protocol }}://{{ cmk_omd_host }}/{{ cmk_omd_site }}/check_mk/api/v0/objects/host_config/{{ inventory_hostname | upper }}"
shell:
cmd: |
curl \
-G \
-i \
--request GET \
--write-out "\nxxx-status_code=%{http_code}\n" \
--header "Authorization: Bearer {{ cmk_username }} {{ cmk_secret }}" \
--header "Accept: application/json" \
"{{ cmk_omd_protocol }}://{{ cmk_omd_host }}/{{ cmk_omd_site }}/check_mk/api/v0/objects/host_config/{{ inventory_hostname | upper }}"
register: res_host_exists
become: false
delegate_to: localhost
when: >
cmk_add_host and (cmk_major | int >= 2 and cmk_minor | int >= 2) and
(res_add.status == 400 and output.fields.host_name | first | regex_search('already
@@ -55,8 +55,7 @@
exists.$'))
- name: Update host as already exists? (new)
local_action:
module: uri
uri:
method: PUT
headers:
Authorization: Bearer {{ cmk_username }} {{ cmk_secret }}
@@ -72,6 +71,7 @@
status_code: [200]
register: res
become: false
delegate_to: localhost
when: >
cmk_add_host and (cmk_major | int >= 2 and cmk_minor | int >= 2) and
(res_add.status == 400 and output.fields.host_name | first | regex_search('already
@@ -83,8 +83,7 @@
when: cmk_add_host
- name: cmk_discovery (new)
local_action:
module: uri
uri:
method: POST
headers:
Authorization: Bearer {{ cmk_username }} {{ cmk_secret }}
@@ -96,14 +95,14 @@
body_format: json
status_code: [200, 302]
become: false
delegate_to: localhost
when: >
cmk_add_host and cmk_major | int >= 2 and
cmk_minor | int >= 2 or
cmk_force_install
- name: cmk_apply (new)
local_action:
module: uri
uri:
method: POST
headers:
Authorization: Bearer {{ cmk_username }} {{ cmk_secret }}