Skip to content

Commit 29cda02

Browse files
Merge pull request #93 from tribe29/devel
Bugfix agent role hostname usage and HTTP timeout for discovery
2 parents 55b68f4 + ea0384b commit 29cda02

File tree

7 files changed

+110
-14
lines changed

7 files changed

+110
-14
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# https://docs.ansible.com/ansible/latest/community/development_process.html#changelogs-how-to
2+
3+
bugfixes:
4+
- Fix usage of 'checkmk_agent_host_name'variable. Some tasks had 'inventory_hostname' hardcoded, which is not the desired behavior. This is fixed now.
5+
6+
# known_issues:
7+
# - This release is still in development and a heavy work in progress.
8+
# - Discovery module is not feature complete yet.
9+
# - Downtime module is not fully idempotent yet. This affects service downtimes and deletions.
10+
11+
## Line Format
12+
# When writing a changelog entry, use the following format:
13+
14+
# - scope - description starting with a lowercase letter and ending with a period at the very end. Multiple sentences are allowed (https://github.com/reference/to/an/issue or, if there is no issue, reference to a pull request itself).
15+
16+
# The scope is usually a module or plugin name or group of modules or plugins, for example, lookup plugins. While module names can (and should) be mentioned directly (foo_module), plugin names should always be followed by the type (foo inventory plugin).
17+
18+
# For changes that are not really scoped (for example, which affect a whole collection), use the following format:
19+
20+
# - Description starting with an uppercase letter and ending with a dot at the very end. Multiple sentences are allowed (https://github.com/reference/to/an/issue or, if there is no issue, reference to a pull request itself).
21+
22+
23+
## Possible keys:
24+
25+
# breaking_changes
26+
27+
# Changes that break existing playbooks or roles. This includes any change to existing behavior that forces users to update tasks. Displayed in both the changelogs and the Porting Guides.
28+
# major_changes
29+
30+
# Major changes to Ansible itself. Generally does not include module or plugin changes. Displayed in both the changelogs and the Porting Guides.
31+
# minor_changes
32+
33+
# Minor changes to Ansible, modules, or plugins. This includes new features, new parameters added to modules, or behavior changes to existing parameters.
34+
# deprecated_features
35+
36+
# Features that have been deprecated and are scheduled for removal in a future release. Displayed in both the changelogs and the Porting Guides.
37+
# removed_features
38+
39+
# Features that were previously deprecated and are now removed. Displayed in both the changelogs and the Porting Guides.
40+
# security_fixes
41+
42+
# Fixes that address CVEs or resolve security concerns. Include links to CVE information.
43+
# bugfixes
44+
45+
# Fixes that resolve issues.
46+
# known_issues
47+
48+
# Known issues that are currently not fixed or will not be fixed.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# https://docs.ansible.com/ansible/latest/community/development_process.html#changelogs-how-to
2+
3+
bugfixes:
4+
- Increase HTTP timeout for the discovery module, because the discovery can take some time depending on the discovered device.
5+
6+
# known_issues:
7+
# - This release is still in development and a heavy work in progress.
8+
# - Discovery module is not feature complete yet.
9+
# - Downtime module is not fully idempotent yet. This affects service downtimes and deletions.
10+
11+
## Line Format
12+
# When writing a changelog entry, use the following format:
13+
14+
# - scope - description starting with a lowercase letter and ending with a period at the very end. Multiple sentences are allowed (https://github.com/reference/to/an/issue or, if there is no issue, reference to a pull request itself).
15+
16+
# The scope is usually a module or plugin name or group of modules or plugins, for example, lookup plugins. While module names can (and should) be mentioned directly (foo_module), plugin names should always be followed by the type (foo inventory plugin).
17+
18+
# For changes that are not really scoped (for example, which affect a whole collection), use the following format:
19+
20+
# - Description starting with an uppercase letter and ending with a dot at the very end. Multiple sentences are allowed (https://github.com/reference/to/an/issue or, if there is no issue, reference to a pull request itself).
21+
22+
23+
## Possible keys:
24+
25+
# breaking_changes
26+
27+
# Changes that break existing playbooks or roles. This includes any change to existing behavior that forces users to update tasks. Displayed in both the changelogs and the Porting Guides.
28+
# major_changes
29+
30+
# Major changes to Ansible itself. Generally does not include module or plugin changes. Displayed in both the changelogs and the Porting Guides.
31+
# minor_changes
32+
33+
# Minor changes to Ansible, modules, or plugins. This includes new features, new parameters added to modules, or behavior changes to existing parameters.
34+
# deprecated_features
35+
36+
# Features that have been deprecated and are scheduled for removal in a future release. Displayed in both the changelogs and the Porting Guides.
37+
# removed_features
38+
39+
# Features that were previously deprecated and are now removed. Displayed in both the changelogs and the Porting Guides.
40+
# security_fixes
41+
42+
# Fixes that address CVEs or resolve security concerns. Include links to CVE information.
43+
# bugfixes
44+
45+
# Fixes that resolve issues.
46+
# known_issues
47+
48+
# Known issues that are currently not fixed or will not be fixed.

galaxy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace: tribe29
99
name: checkmk
1010

1111
# The version of the collection. Must be compatible with semantic versioning
12-
version: 0.5.1
12+
version: 0.5.2
1313

1414
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
1515
readme: README.md

plugins/modules/discovery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def run_module():
136136
)
137137
url = base_url + api_endpoint
138138
response, info = fetch_url(
139-
module, url, module.jsonify(params), headers=headers, method="POST"
139+
module, url, module.jsonify(params), headers=headers, method="POST", timeout=60
140140
)
141141
http_code = info["status"]
142142

roles/agent/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ The user used to authenticate against your Checkmk site.
4141

4242
The password for the user used to authenticate against your Checkmk site.
4343

44+
checkmk_agent_add_host: 'false'
45+
46+
Automatically add the host where the agent was installed to Checkmk.
47+
48+
checkmk_agent_discover: 'false'
49+
50+
Automatically discover services on the host where the agent was installed.
51+
4452
checkmk_agent_update: 'false'
4553

4654
Register host for automatic updates. Make sure to have the server side prepared
@@ -59,14 +67,6 @@ Automatically configure the firewall to allow access to the Checkmk agent.
5967

6068
Enable this to automatically install `xinetd` on hosts with systemd prior to version 220.
6169

62-
checkmk_agent_add_host: 'false'
63-
64-
Automatically add the host where the agent was installed to Checkmk.
65-
66-
checkmk_agent_discover: 'false'
67-
68-
Automatically discover services on the host where the agent was installed.
69-
7070
checkmk_agent_delegate_api_calls: localhost
7171

7272
Configure the host to which Checkmk API calls are delegated to.

roles/agent/defaults/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ checkmk_agent_server: localhost
66
checkmk_agent_site: my_site
77
checkmk_agent_user: "{{ automation_user | default('automation') }}"
88
checkmk_agent_pass: "{{ automation_secret | default('SECRET') }}"
9+
checkmk_agent_add_host: 'false'
10+
checkmk_agent_discover: 'false'
911
checkmk_agent_update: 'false'
1012
checkmk_agent_tls: 'false'
1113
checkmk_agent_configure_firewall: 'true'
1214
checkmk_agent_prep_legacy: 'false'
13-
checkmk_agent_add_host: 'false'
14-
checkmk_agent_discover: 'false'
1515
checkmk_agent_delegate_api_calls: localhost
1616
checkmk_agent_host_name: "{{ inventory_hostname }}"
1717

roles/agent/tasks/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
- name: "Register Agent for automatic Upates."
4040
become: true
4141
ansible.builtin.shell: |
42-
cmk-update-agent register -H {{ inventory_hostname }} \
42+
cmk-update-agent register -H {{ checkmk_agent_host_name }} \
4343
-s {{ checkmk_agent_server }} -i {{ checkmk_agent_site }} -p {{ checkmk_agent_protocol }} \
4444
-U {{ checkmk_agent_user }} -S {{ checkmk_agent_pass }}
4545
register: checkmk_agent_update_state
@@ -48,7 +48,7 @@
4848
- name: "Register Agent for TLS."
4949
become: true
5050
ansible.builtin.shell: |
51-
cmk-agent-ctl register -H {{ inventory_hostname }} \
51+
cmk-agent-ctl register -H {{ checkmk_agent_host_name }} \
5252
-s {{ checkmk_agent_server }} -i {{ checkmk_agent_site }} \
5353
-U {{ checkmk_agent_user }} -P {{ checkmk_agent_pass }} --trust-cert
5454
register: checkmk_agent_tls_state

0 commit comments

Comments
 (0)