Closed JordyEGNL closed 2 days ago
It seems that the following tasks use the cmk-agent-ctl register ...
command
- name: "{{ ansible_system }}: Register Agent for automatic Updates using User Password."
become: true
ansible.builtin.shell: |
cmk-update-agent register -H {{ checkmk_agent_host_name }} \
-s {{ checkmk_agent_registration_server }} -i {{ checkmk_agent_registration_site }} -p {{ checkmk_agent_registration_server_protocol }} \
-U {{ checkmk_agent_user }} -P {{ __checkmk_agent_auth }}
no_log: "{{ checkmk_agent_no_log | bool }}"
register: __checkmk_agent_update_state
when: |
checkmk_agent_edition | lower != "cre"
and __checkmk_agent_updater_binary.stat.exists | bool
and checkmk_agent_update | bool
and (checkmk_agent_pass is defined and checkmk_agent_pass | length)
and (checkmk_agent_secret is not defined)
and not ((checkmk_agent_registration_server + '/' + checkmk_agent_registration_site in __checkmk_agent_updater_state.stdout)
and ('"error": null' in __checkmk_agent_updater_state.stdout) )
changed_when: "'Successfully registered agent of host' in __checkmk_agent_update_state.stderr"
- name: "{{ ansible_system }}: Register Agent for automatic Updates using Automation Secret."
become: true
ansible.builtin.shell: |
cmk-update-agent register -H {{ checkmk_agent_host_name }} \
-s {{ checkmk_agent_registration_server }} -i {{ checkmk_agent_registration_site }} -p {{ checkmk_agent_registration_server_protocol }} \
-U {{ checkmk_agent_user }} -S {{ __checkmk_agent_auth }}
no_log: "{{ checkmk_agent_no_log | bool }}"
register: __checkmk_agent_update_state
when: |
checkmk_agent_edition | lower != "cre"
and __checkmk_agent_updater_binary.stat.exists | bool
and checkmk_agent_update | bool
and (checkmk_agent_secret is defined and checkmk_agent_secret | length)
and not ((checkmk_agent_registration_server + '/' + checkmk_agent_registration_site in __checkmk_agent_updater_state.stdout)
and ('"error": null' in __checkmk_agent_updater_state.stdout) )
changed_when: "'Successfully registered agent of host' in __checkmk_agent_update_state.stderr"
- name: "{{ ansible_system }}: Register Agent for TLS."
become: true
ansible.builtin.shell: |
cmk-agent-ctl register -H {{ checkmk_agent_host_name }} \
-s {{ checkmk_agent_registration_server }} -i {{ checkmk_agent_registration_site }} \
-U {{ checkmk_agent_user }} -P {{ __checkmk_agent_auth }} --trust-cert
no_log: "{{ checkmk_agent_no_log | bool }}"
register: __checkmk_agent_tls_state
when: |
__checkmk_agent_controller_binary.stat.exists | bool
and checkmk_agent_tls | bool
and (__checkmk_agent_auth is defined and __checkmk_agent_auth | length)
and not checkmk_agent_registration_server + '/' + checkmk_agent_registration_site in __checkmk_agent_registered_connections.stdout
changed_when: "'Registration complete' in __checkmk_agent_tls_state.stdout"
So for the Raw Edition the following variable needs to be set to true
.
checkmk_agent_tls: 'true'
This does also set the --trust-cert
option as seen above :)
Everything is now working as expected
(maybe do not run the checkmk.general.agent : Linux: Verify Checkmk Agent Port is open.
task when checkmk_agent_tls
or checkmk_agent_update
is set to false
)
Verify first that your issue is not already reported here. Where possible also test if the latest release and main branch are affected too. Complete all sections as described!
Describe the bug When trying to install the agent to a Ubuntu Server 24.04 LTS it fails at the task
checkmk.general.agent : Linux: Verify Checkmk Agent Port is open.
This is my playbook:
This is my variable file (with password removed of course). Everything is accessible locally.
Fails with following error
When using the following command on the host everything works fine. cmk-agent-ctl is successfully installed with Ansible, but does not connect to the remote server.
Component Name Component Name: checkmk.general.agent
Ansible Version
Checkmk Version and Edition
Collection Version
To Reproduce Steps to reproduce the behavior:
ansible-playbook setup_vps.yml -i inventory/default.yml -K -vvv
checkmk.general.agent : Linux: Verify Checkmk Agent Port is open.
Expected behavior The cmk-agent service should start before the opening of the port is checked
Actual behavior Task does fail because the agent doesn't start
Additional context The hosts are already added to the CMK Dashboard (applied the changes). When manually adding the cmk-agent to the hosts everything is working as expected.
checkmk.hoebergen.net
is available from within my network and goes to Traefik that forwards the request to the checkmk docker container on port 500010.0.10.110:8000
directly goes to the checkmk server (skips Traefik)