Skip to content

Commit

Permalink
Allow registering on a http subsite with a https central site.
Browse files Browse the repository at this point in the history
Currently the variable `checkmk_agent_server_protocol` is used both for downloading the agent at the central site,
and for registering the agent at the subsite, therefore making it mandatory to use http or https on both sites without mixing.

Introduces a new variable `checkmk_agent_registration_server_protocol` which defaults to `checkmk_agent_server_protocol`,
similar to the other `checkmk_agent_registration_*` variables to solve that.
  • Loading branch information
gfokkema committed Jul 12, 2024
1 parent 4b42944 commit 80ca896
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions roles/agent/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ checkmk_agent_edition: cre
checkmk_agent_server_protocol: http
checkmk_agent_server: localhost
checkmk_agent_site: mysite
checkmk_agent_registration_server_protocol: "{{ checkmk_agent_server_protocol }}"
checkmk_agent_registration_server: "{{ checkmk_agent_server }}"
checkmk_agent_registration_site: "{{ checkmk_agent_site }}"
checkmk_agent_server_validate_certs: 'true'
Expand Down
1 change: 1 addition & 0 deletions roles/agent/molecule/2.1.0/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ checkmk_agent_edition: "{{ checkmk_var_edition }}"
checkmk_agent_server_protocol: http
checkmk_agent_server: 127.0.0.1
checkmk_agent_site: "{{ checkmk_var_checkmk_site }}"
checkmk_agent_registration_server_protocol: "{{ checkmk_agent_server_protocol }}"
checkmk_agent_registration_server: "{{ checkmk_agent_server }}"
checkmk_agent_registration_site: "{{ checkmk_agent_site }}"
checkmk_agent_server_validate_certs: 'false'
Expand Down
1 change: 1 addition & 0 deletions roles/agent/molecule/2.2.0/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ checkmk_agent_edition: "{{ checkmk_var_edition }}"
checkmk_agent_server_protocol: http
checkmk_agent_server: 127.0.0.1
checkmk_agent_site: "{{ checkmk_var_checkmk_site }}"
checkmk_agent_registration_server_protocol: "{{ checkmk_agent_server_protocol }}"
checkmk_agent_registration_server: "{{ checkmk_agent_server }}"
checkmk_agent_registration_site: "{{ checkmk_agent_site }}"
checkmk_agent_server_validate_certs: 'false'
Expand Down
1 change: 1 addition & 0 deletions roles/agent/molecule/2.3.0/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ checkmk_agent_edition: "{{ checkmk_var_edition }}"
checkmk_agent_server_protocol: http
checkmk_agent_server: 127.0.0.1
checkmk_agent_site: "{{ checkmk_var_checkmk_site }}"
checkmk_agent_registration_server_protocol: "{{ checkmk_agent_server_protocol }}"
checkmk_agent_registration_server: "{{ checkmk_agent_server }}"
checkmk_agent_registration_site: "{{ checkmk_agent_site }}"
checkmk_agent_server_validate_certs: 'false'
Expand Down
4 changes: 2 additions & 2 deletions roles/agent/tasks/Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
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_server_protocol }} \
-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
Expand All @@ -122,7 +122,7 @@
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_server_protocol }} \
-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
Expand Down
2 changes: 1 addition & 1 deletion roles/agent/tasks/Win32NT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
- name: "{{ ansible_system }}: Register Agent for automatic Updates using Automation Secret." # noqa no-changed-when
ansible.windows.win_command: |
check_mk_agent.exe updater register -H {{ checkmk_agent_host_name }} \
-s {{ checkmk_agent_registration_server }} -i {{ checkmk_agent_registration_site }} -p {{ checkmk_agent_server_protocol }} \
-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
Expand Down

0 comments on commit 80ca896

Please sign in to comment.