rescue block for agent installation

This commit is contained in:
abrown38 committed 2025-05-22 11:29:03 +01:00
1 parent 1423931249
commit 882676ee04
1 file changed
+19 -17
+19 -17
View File
@@ -123,25 +123,27 @@
block:
- name: Gather Facts
setup:
tags:
- checkmk_all
- checkmk_agent
tags: checkmk_agent
- name: Install CheckMK agent on VMs
import_role:
name: agent
tags:
- checkmk_all
- checkmk_agent
tags: checkmk_agent
- name: TLS registrtion
block:
- name: register for TLS
win_shell: |
sl 'C:\Program Files (x86)\checkmk\service'
.\cmk-agent-ctl register --hostname {{ inventory_hostname }} --server {{ checkmk_server }} --site {{ checkmk_agent_site }} --user {{ checkmk_agent_user }} --password '{{ checkmk_password }}' --trust-cert
tags:
- checkmk_host
- checkmk_tls
- checkmk_all
rescue:
- name: restart agent service
win_shell: |
powershell Restart-Service -Name CheckmkService
tags: always
- name: Retry agent installation
import_role:
name: agent
tags: always
always:
- name: register for TLS
win_shell: |
sl 'C:\Program Files (x86)\checkmk\service'
.\cmk-agent-ctl register --hostname {{ inventory_hostname }} --server {{ checkmk_server }} --site {{ checkmk_agent_site }} --user {{ checkmk_agent_user }} --password '{{ checkmk_password }}' --trust-cert
tags: [checkmk_all, checkmk_agent, checkmk_tls]