From 2007d06352f1616aa4fa57b56a7c1140e2cf00b9 Mon Sep 17 00:00:00 2001 From: Michael Sekania Date: Fri, 28 Oct 2022 15:54:47 +0200 Subject: [PATCH 01/22] Change host_group_name and host_groups with name and groups, respectively --- plugins/modules/host_group.py | 82 +++++++++---------- .../targets/host_group/tasks/test.yml | 30 +++---- 2 files changed, 55 insertions(+), 57 deletions(-) diff --git a/plugins/modules/host_group.py b/plugins/modules/host_group.py index 9a3855e2f..09abb1fa7 100644 --- a/plugins/modules/host_group.py +++ b/plugins/modules/host_group.py @@ -24,15 +24,15 @@ extends_documentation_fragment: [tribe29.checkmk.common] options: - host_group_name: + name: description: The name of the host group to be created/modified/deleted. type: str title: - description: The title (alias) of your host group. If omitted defaults to the host_group_name. + description: The title (alias) of your host group. If omitted defaults to the name. type: str - host_groups: + groups: description: - - instead of 'host_group_name', 'title' a list of dicts with elements of host group name and title (alias) to be created/modified/deleted. + - instead of 'name', 'title' a list of dicts with elements of host group name and title (alias) to be created/modified/deleted. If title is omitted in entry, it defaults to the host group name. default: [] type: raw @@ -58,7 +58,7 @@ site: "my_site" automation_user: "automation" automation_secret: "$SECRET" - host_group_name: "my_host_group" + name: "my_host_group" title: "My Host Group" state: "present" @@ -69,7 +69,7 @@ site: "my_site" automation_user: "automation" automation_secret: "$SECRET" - host_groups: + groups: - name: "my_host_group_one" title: "My Host Group One" - name: "my_host_group_two" @@ -85,7 +85,7 @@ site: "my_site" automation_user: "automation" automation_secret: "$SECRET" - host_groups: + groups: - name: "my_host_group_one" title: "My Host Group One" - name: "my_host_group_two" @@ -99,7 +99,7 @@ site: "my_site" automation_user: "automation" automation_secret: "$SECRET" - host_group_name: "my_host_group" + name: "my_host_group" state: "absent" # Delete several host groups. @@ -109,7 +109,7 @@ site: "my_site" automation_user: "automation" automation_secret: "$SECRET" - host_groups: + groups: - name: "my_host_group_one" - name: "my_host_group_two" state: "absent" @@ -149,9 +149,9 @@ def get_current_single_host_group(module, base_url, headers): current_state = "unknown" current_title = "" etag = "" - host_group_name = module.params["host_group_name"] + name = module.params["name"] - api_endpoint = "/objects/host_group_config/" + host_group_name + api_endpoint = "/objects/host_group_config/" + name url = base_url + api_endpoint response, info = fetch_url(module, url, data=None, headers=headers, method="GET") @@ -160,7 +160,7 @@ def get_current_single_host_group(module, base_url, headers): body = json.loads(response.read()) current_state = "present" etag = info.get("etag", "") - current_title = body.get("title", host_group_name) + current_title = body.get("title", name) elif info["status"] == 404: current_state = "absent" @@ -204,11 +204,11 @@ def get_current_host_groups(module, base_url, headers): def update_single_host_group(module, base_url, headers): - host_group_name = module.params["host_group_name"] + name = module.params["name"] - api_endpoint = "/objects/host_group_config/" + host_group_name + api_endpoint = "/objects/host_group_config/" + name params = { - "alias": module.params.get("title", host_group_name), + "alias": module.params.get("title", name), } url = base_url + api_endpoint @@ -224,7 +224,7 @@ def update_single_host_group(module, base_url, headers): ) -def update_host_groups(module, base_url, host_groups, headers): +def update_host_groups(module, base_url, groups, headers): api_endpoint = "/domain-types/host_group_config/actions/bulk-update/invoke" params = { "entries": [ @@ -234,7 +234,7 @@ def update_host_groups(module, base_url, host_groups, headers): "alias": el.get("title", el.get("name")), }, } - for el in host_groups + for el in groups ], } url = base_url + api_endpoint @@ -252,12 +252,12 @@ def update_host_groups(module, base_url, host_groups, headers): def create_single_host_group(module, base_url, headers): - host_group_name = module.params["host_group_name"] + name = module.params["name"] api_endpoint = "/domain-types/host_group_config/collections/all" params = { - "name": host_group_name, - "alias": module.params.get("title", host_group_name), + "name": name, + "alias": module.params.get("title", name), } url = base_url + api_endpoint @@ -273,7 +273,7 @@ def create_single_host_group(module, base_url, headers): ) -def create_host_groups(module, base_url, host_groups, headers): +def create_host_groups(module, base_url, groups, headers): api_endpoint = "/domain-types/host_group_config/actions/bulk-create/invoke" params = { "entries": [ @@ -281,7 +281,7 @@ def create_host_groups(module, base_url, host_groups, headers): "name": el.get("name"), "alias": el.get("title", el.get("name")), } - for el in host_groups + for el in groups ], } url = base_url + api_endpoint @@ -299,7 +299,7 @@ def create_host_groups(module, base_url, host_groups, headers): def delete_single_host_group(module, base_url, headers): - api_endpoint = "/objects/host_group_config/" + module.params["host_group_name"] + api_endpoint = "/objects/host_group_config/" + module.params["name"] url = base_url + api_endpoint response, info = fetch_url(module, url, data=None, headers=headers, method="DELETE") @@ -312,10 +312,10 @@ def delete_single_host_group(module, base_url, headers): ) -def delete_host_groups(module, base_url, host_groups, headers): +def delete_host_groups(module, base_url, groups, headers): api_endpoint = "/domain-types/host_group_config/actions/bulk-delete/invoke" params = { - "entries": [el["name"] for el in host_groups], + "entries": [el["name"] for el in groups], } url = base_url + api_endpoint @@ -338,19 +338,19 @@ def run_module(): validate_certs=dict(type="bool", required=False, default=True), automation_user=dict(type="str", required=True), automation_secret=dict(type="str", required=True, no_log=True), - host_group_name=dict(type="str", required=False), + name=dict(type="str", required=False), title=dict(type="str", required=False), - host_groups=dict(type="raw", required=False), + groups=dict(type="raw", required=False), state=dict(type="str", default="present", choices=["present", "absent"]), ) module = AnsibleModule( argument_spec=module_args, mutually_exclusive=[ - ("host_groups", "host_group_name"), + ("groups", "name"), ], required_one_of=[ - ("host_groups", "host_group_name"), + ("groups", "name"), ], supports_check_mode=False, ) @@ -375,31 +375,29 @@ def run_module(): state = module.params.get("state", "present") if ( - "host_groups" in module.params - and module.params.get("host_groups") - and len(module.params.get("host_groups", [])) > 0 + "groups" in module.params + and module.params.get("groups") + and len(module.params.get("groups", [])) > 0 ): if "title" in module.params and module.params.get("title", ""): exit_failed( module, - "'title' has only effect when 'host_group_name' is defined and not 'host_groups'", + "'title' has only effect when 'name' is defined and not 'groups'", ) - host_groups = module.params.get("host_groups") + groups = module.params.get("groups") # Determine which host groups do already exest current_groups = get_current_host_groups(module, base_url, headers) # Determine intersection and difference with input, according to 'name' only - if len(set([el.get("name") for el in host_groups])) != len(host_groups): + if len(set([el.get("name") for el in groups])) != len(groups): exit_failed(module, "two or more entries with the same name!") listofnames = set([el.get("name") for el in current_groups]) - intersection_list = [el for el in host_groups if el.get("name") in listofnames] - difference_list = [ - el for el in host_groups if not el.get("name") in listofnames - ] + intersection_list = [el for el in groups if el.get("name") in listofnames] + difference_list = [el for el in groups if not el.get("name") in listofnames] # Handle the host group accordingly to above findings and desired state if state == "present": @@ -456,8 +454,8 @@ def run_module(): else: exit_failed(module, "Unknown error") - elif "host_group_name" in module.params and module.params.get( - "host_group_name", "" + elif "name" in module.params and module.params.get( + "name", "" ): # Determine the current state of this particular host group ( @@ -495,7 +493,7 @@ def run_module(): exit_failed(module, "Unknown error") else: exit_failed( - module, "One shoudl define either 'host_groups' or 'host_group_name'" + module, "One shoudl define either 'groups' or 'name'" ) diff --git a/tests/integration/targets/host_group/tasks/test.yml b/tests/integration/targets/host_group/tasks/test.yml index 8fbc3f9dc..20d788aa1 100644 --- a/tests/integration/targets/host_group/tasks/test.yml +++ b/tests/integration/targets/host_group/tasks/test.yml @@ -5,22 +5,22 @@ site: "{{ outer_item.site }}" automation_user: "{{ automation_user }}" automation_secret: "{{ automation_secret }}" - host_group_name: "{{ item.name }}" + name: "{{ item.name }}" title: "{{ item.title | default(item.name) }}" state: "present" delegate_to: localhost run_once: true loop: "{{ checkmk_host_groups_create }}" -- name: "{{ outer_item.version }} - Should fail because of 'host_groups', Create host groups." +- name: "{{ outer_item.version }} - Should fail because of 'groups', Create host groups." host_group: server_url: "{{ server_url }}" site: "{{ outer_item.site }}" automation_user: "{{ automation_user }}" automation_secret: "{{ automation_secret }}" - host_group_name: "{{ item.name }}" + name: "{{ item.name }}" title: "{{ item.title | default(item.name) }}" - host_groups: checkmk_host_groups_create + groups: checkmk_host_groups_create state: "present" delegate_to: localhost run_once: true @@ -45,7 +45,7 @@ site: "{{ outer_item.site }}" automation_user: "{{ automation_user }}" automation_secret: "{{ automation_secret }}" - host_group_name: "{{ item.name | default(item.name) }}" + name: "{{ item.name | default(item.name) }}" title: "{{ item.title }}" state: "present" delegate_to: localhost @@ -70,7 +70,7 @@ site: "{{ outer_item.site }}" automation_user: "{{ automation_user }}" automation_secret: "{{ automation_secret }}" - host_group_name: "{{ item.name }}" + name: "{{ item.name }}" state: "absent" delegate_to: localhost run_once: true @@ -94,7 +94,7 @@ site: "{{ outer_item.site }}" automation_user: "{{ automation_user }}" automation_secret: "{{ automation_secret }}" - host_group_name: "{{ item.name }}" + name: "{{ item.name }}" state: "absent" delegate_to: localhost run_once: true @@ -118,19 +118,19 @@ site: "{{ outer_item.site }}" automation_user: "{{ automation_user }}" automation_secret: "{{ automation_secret }}" - host_groups: "{{ checkmk_host_groups_create }}" + groups: "{{ checkmk_host_groups_create }}" state: "present" delegate_to: localhost run_once: true -- name: "{{ outer_item.version }} - Should fail because of 'host_group_name', Bulk create host groups." +- name: "{{ outer_item.version }} - Should fail because of 'name', Bulk create host groups." host_group: server_url: "{{ server_url }}" site: "{{ outer_item.site }}" automation_user: "{{ automation_user }}" automation_secret: "{{ automation_secret }}" - host_groups: "{{ checkmk_host_groups_create }}" - host_group_name: "test" + groups: "{{ checkmk_host_groups_create }}" + name: "test" state: "present" delegate_to: localhost run_once: true @@ -142,7 +142,7 @@ site: "{{ outer_item.site }}" automation_user: "{{ automation_user }}" automation_secret: "{{ automation_secret }}" - host_groups: "{{ checkmk_host_groups_create }}" + groups: "{{ checkmk_host_groups_create }}" title: "Test" state: "present" delegate_to: localhost @@ -155,7 +155,7 @@ site: "{{ outer_item.site }}" automation_user: "{{ automation_user }}" automation_secret: "{{ automation_secret }}" - host_groups: "{{ checkmk_host_groups_modify }}" + groups: "{{ checkmk_host_groups_modify }}" state: "present" delegate_to: localhost run_once: true @@ -166,7 +166,7 @@ site: "{{ outer_item.site }}" automation_user: "{{ automation_user }}" automation_secret: "{{ automation_secret }}" - host_groups: "{{ checkmk_host_groups_delete }}" + groups: "{{ checkmk_host_groups_delete }}" state: "absent" delegate_to: localhost run_once: true @@ -177,7 +177,7 @@ site: "{{ outer_item.site }}" automation_user: "{{ automation_user }}" automation_secret: "{{ automation_secret }}" - host_groups: "{{ checkmk_host_groups_create }}" + groups: "{{ checkmk_host_groups_create }}" state: "absent" delegate_to: localhost run_once: true From fbfde4ab95d02a22edd693556adf3e8c1ce92a44 Mon Sep 17 00:00:00 2001 From: Michael Sekania Date: Fri, 28 Oct 2022 15:57:14 +0200 Subject: [PATCH 02/22] fix style --- plugins/modules/host_group.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/plugins/modules/host_group.py b/plugins/modules/host_group.py index 09abb1fa7..2b8111983 100644 --- a/plugins/modules/host_group.py +++ b/plugins/modules/host_group.py @@ -454,9 +454,7 @@ def run_module(): else: exit_failed(module, "Unknown error") - elif "name" in module.params and module.params.get( - "name", "" - ): + elif "name" in module.params and module.params.get("name", ""): # Determine the current state of this particular host group ( current_state, @@ -492,9 +490,7 @@ def run_module(): else: exit_failed(module, "Unknown error") else: - exit_failed( - module, "One shoudl define either 'groups' or 'name'" - ) + exit_failed(module, "One shoudl define either 'groups' or 'name'") def main(): From 9cf681c62c291843ce8eed21e752f461524706b6 Mon Sep 17 00:00:00 2001 From: Michael Sekania Date: Fri, 2 Dec 2022 15:52:09 +0100 Subject: [PATCH 03/22] Add aliases for name and groups --- plugins/modules/host_group.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/modules/host_group.py b/plugins/modules/host_group.py index 3f6f4b2d9..ef08bfa32 100644 --- a/plugins/modules/host_group.py +++ b/plugins/modules/host_group.py @@ -334,9 +334,9 @@ def run_module(): validate_certs=dict(type="bool", required=False, default=True), automation_user=dict(type="str", required=True), automation_secret=dict(type="str", required=True, no_log=True), - name=dict(type="str", required=False), + name=dict(type="str", required=False, aliases=['host_group_name']), title=dict(type="str", required=False), - groups=dict(type="raw", required=False, default=[]), + groups=dict(type="raw", required=False, default=[], aliases=['host_groups']), state=dict(type="str", default="present", choices=["present", "absent"]), ) @@ -378,7 +378,7 @@ def run_module(): if "title" in module.params and module.params.get("title", ""): exit_failed( module, - "'title' has only effect when 'name' is defined and not 'groups'", + "'title' has only effect when 'name' (depricated alias 'host_group_name') is defined and not 'groups' (depricated alias 'host_groups')", ) groups = module.params.get("groups") From 9fc53465b89078a7254f35e4a2f3fed7a788cbad Mon Sep 17 00:00:00 2001 From: Michael Sekania Date: Fri, 2 Dec 2022 15:55:40 +0100 Subject: [PATCH 04/22] Fix style --- plugins/modules/host_group.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/modules/host_group.py b/plugins/modules/host_group.py index ef08bfa32..71c836ad8 100644 --- a/plugins/modules/host_group.py +++ b/plugins/modules/host_group.py @@ -334,9 +334,9 @@ def run_module(): validate_certs=dict(type="bool", required=False, default=True), automation_user=dict(type="str", required=True), automation_secret=dict(type="str", required=True, no_log=True), - name=dict(type="str", required=False, aliases=['host_group_name']), + name=dict(type="str", required=False, aliases=["host_group_name"]), title=dict(type="str", required=False), - groups=dict(type="raw", required=False, default=[], aliases=['host_groups']), + groups=dict(type="raw", required=False, default=[], aliases=["host_groups"]), state=dict(type="str", default="present", choices=["present", "absent"]), ) From 3d31330abc2ceb40418f50828d3c0f14d1939fe5 Mon Sep 17 00:00:00 2001 From: Michael Sekania Date: Fri, 2 Dec 2022 16:05:31 +0100 Subject: [PATCH 05/22] Add documantation for depricated aliases host_group_name and host_groups --- plugins/modules/host_group.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/modules/host_group.py b/plugins/modules/host_group.py index 71c836ad8..badb177f4 100644 --- a/plugins/modules/host_group.py +++ b/plugins/modules/host_group.py @@ -27,6 +27,7 @@ name: description: The name of the host group to be created/modified/deleted. type: str + host_group_name: depricated alias of name title: description: The title (alias) of your host group. If omitted defaults to the name. type: str @@ -36,6 +37,7 @@ If title is omitted in entry, it defaults to the host group name. default: [] type: raw + host_groups: depricated alias of group state: description: The state of your host group. type: str From 6d4635d5680d04dcca0ee04410ff72b61cc2355e Mon Sep 17 00:00:00 2001 From: Michael Sekania Date: Fri, 2 Dec 2022 16:13:21 +0100 Subject: [PATCH 06/22] Fix entries for documentation --- plugins/modules/host_group.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/modules/host_group.py b/plugins/modules/host_group.py index badb177f4..8d74edc88 100644 --- a/plugins/modules/host_group.py +++ b/plugins/modules/host_group.py @@ -27,7 +27,9 @@ name: description: The name of the host group to be created/modified/deleted. type: str - host_group_name: depricated alias of name + host_group_name: + description: depricated alias of name + type: str title: description: The title (alias) of your host group. If omitted defaults to the name. type: str @@ -37,7 +39,10 @@ If title is omitted in entry, it defaults to the host group name. default: [] type: raw - host_groups: depricated alias of group + host_groups: + description: depricated alias of group + default: [] + type: raw state: description: The state of your host group. type: str From b024e5aaca30fb22613fc7a8f4ff08c519d82613 Mon Sep 17 00:00:00 2001 From: Michael Sekania Date: Fri, 2 Dec 2022 16:18:49 +0100 Subject: [PATCH 07/22] Fix entries for documentation --- plugins/modules/host_group.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/plugins/modules/host_group.py b/plugins/modules/host_group.py index 8d74edc88..dbbaf2dbd 100644 --- a/plugins/modules/host_group.py +++ b/plugins/modules/host_group.py @@ -27,9 +27,7 @@ name: description: The name of the host group to be created/modified/deleted. type: str - host_group_name: - description: depricated alias of name - type: str + aliases: [host_group_name] title: description: The title (alias) of your host group. If omitted defaults to the name. type: str @@ -39,10 +37,7 @@ If title is omitted in entry, it defaults to the host group name. default: [] type: raw - host_groups: - description: depricated alias of group - default: [] - type: raw + aliases: [host_groups] state: description: The state of your host group. type: str From ad72493f5e2307cb571eea1cafe04160ca511984 Mon Sep 17 00:00:00 2001 From: Michael Sekania Date: Fri, 2 Dec 2022 16:28:53 +0100 Subject: [PATCH 08/22] Spell --- plugins/modules/host_group.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/modules/host_group.py b/plugins/modules/host_group.py index dbbaf2dbd..c746b11fa 100644 --- a/plugins/modules/host_group.py +++ b/plugins/modules/host_group.py @@ -38,6 +38,7 @@ default: [] type: raw aliases: [host_groups] + state: description: The state of your host group. type: str @@ -380,12 +381,12 @@ def run_module(): if "title" in module.params and module.params.get("title", ""): exit_failed( module, - "'title' has only effect when 'name' (depricated alias 'host_group_name') is defined and not 'groups' (depricated alias 'host_groups')", + "'title' has only effect when 'name' (deprecated alias 'host_group_name') is defined and not 'groups' (deprecated alias 'host_groups')", ) groups = module.params.get("groups") - # Determine which host groups do already exest + # Determine which host groups do already exist current_groups = get_current_host_groups(module, base_url, headers) # Determine intersection and difference with input, according to 'name' only @@ -488,7 +489,7 @@ def run_module(): else: exit_failed(module, "Unknown error") else: - exit_failed(module, "One shoudl define either 'groups' or 'name'") + exit_failed(module, "One should define either 'groups' or 'name'") def main(): From 2740af6737b968cd2e86cf2b6ea1ebb872c15119 Mon Sep 17 00:00:00 2001 From: Michael Sekania Date: Fri, 2 Dec 2022 16:38:15 +0100 Subject: [PATCH 09/22] Cleanup --- plugins/modules/host_group.py | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/modules/host_group.py b/plugins/modules/host_group.py index c746b11fa..399f810b8 100644 --- a/plugins/modules/host_group.py +++ b/plugins/modules/host_group.py @@ -38,7 +38,6 @@ default: [] type: raw aliases: [host_groups] - state: description: The state of your host group. type: str From f261737b4642e92d06da4f430e445371a2cab0c5 Mon Sep 17 00:00:00 2001 From: Michael Sekania Date: Fri, 2 Dec 2022 17:03:45 +0100 Subject: [PATCH 10/22] Add deprecated_aliases for host_group_name and host_groups --- plugins/modules/host_group.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/modules/host_group.py b/plugins/modules/host_group.py index 399f810b8..480c035d0 100644 --- a/plugins/modules/host_group.py +++ b/plugins/modules/host_group.py @@ -28,6 +28,7 @@ description: The name of the host group to be created/modified/deleted. type: str aliases: [host_group_name] + deprecated_aliases=[{"name": "host_group_name"}] title: description: The title (alias) of your host group. If omitted defaults to the name. type: str @@ -38,6 +39,7 @@ default: [] type: raw aliases: [host_groups] + deprecated_aliases=[{"name": "host_group"}] state: description: The state of your host group. type: str @@ -338,8 +340,8 @@ def run_module(): automation_secret=dict(type="str", required=True, no_log=True), name=dict(type="str", required=False, aliases=["host_group_name"]), title=dict(type="str", required=False), - groups=dict(type="raw", required=False, default=[], aliases=["host_groups"]), - state=dict(type="str", default="present", choices=["present", "absent"]), + groups=dict(type="raw", required=False, default=[], aliases=["host_groups"], deprecated_aliases=[{"name": "host_group_name"}]), + state=dict(type="str", default="present", choices=["present", "absent"], deprecated_aliases=[{"name": "host_groups"}]), ) module = AnsibleModule( From 5e357158a3eada89c8afedd5be14f811255ef7ab Mon Sep 17 00:00:00 2001 From: Michael Sekania Date: Fri, 2 Dec 2022 17:08:53 +0100 Subject: [PATCH 11/22] Fix style --- plugins/modules/host_group.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/plugins/modules/host_group.py b/plugins/modules/host_group.py index 480c035d0..28950be4b 100644 --- a/plugins/modules/host_group.py +++ b/plugins/modules/host_group.py @@ -338,10 +338,21 @@ def run_module(): validate_certs=dict(type="bool", required=False, default=True), automation_user=dict(type="str", required=True), automation_secret=dict(type="str", required=True, no_log=True), - name=dict(type="str", required=False, aliases=["host_group_name"]), + name=dict( + type="str", + required=False, + aliases=["host_group_name"], + deprecated_aliases=[{"name": "host_group_name"}] + ), title=dict(type="str", required=False), - groups=dict(type="raw", required=False, default=[], aliases=["host_groups"], deprecated_aliases=[{"name": "host_group_name"}]), - state=dict(type="str", default="present", choices=["present", "absent"], deprecated_aliases=[{"name": "host_groups"}]), + groups=dict( + type="raw", + required=False, + default=[], + aliases=["host_groups"], + deprecated_aliases=[{"name": "host_groups"}] + ), + state=dict(type="str", default="present", choices=["present", "absent"]), ) module = AnsibleModule( From 0f9b3fb56c7460f0e75f72e65098a714991bad5b Mon Sep 17 00:00:00 2001 From: Michael Sekania Date: Fri, 2 Dec 2022 17:11:25 +0100 Subject: [PATCH 12/22] Fix documentation --- plugins/modules/host_group.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/modules/host_group.py b/plugins/modules/host_group.py index 28950be4b..32c22dd17 100644 --- a/plugins/modules/host_group.py +++ b/plugins/modules/host_group.py @@ -28,7 +28,6 @@ description: The name of the host group to be created/modified/deleted. type: str aliases: [host_group_name] - deprecated_aliases=[{"name": "host_group_name"}] title: description: The title (alias) of your host group. If omitted defaults to the name. type: str @@ -39,7 +38,6 @@ default: [] type: raw aliases: [host_groups] - deprecated_aliases=[{"name": "host_group"}] state: description: The state of your host group. type: str @@ -342,7 +340,7 @@ def run_module(): type="str", required=False, aliases=["host_group_name"], - deprecated_aliases=[{"name": "host_group_name"}] + deprecated_aliases=[{"name": "host_group_name"}], ), title=dict(type="str", required=False), groups=dict( @@ -350,7 +348,7 @@ def run_module(): required=False, default=[], aliases=["host_groups"], - deprecated_aliases=[{"name": "host_groups"}] + deprecated_aliases=[{"name": "host_groups"}], ), state=dict(type="str", default="present", choices=["present", "absent"]), ) From 4983c7aa8aeb9c019d1453d66cd38b376559ecb9 Mon Sep 17 00:00:00 2001 From: Michael Sekania Date: Fri, 2 Dec 2022 17:22:11 +0100 Subject: [PATCH 13/22] Ass collection_name and version in deprecated_aliases --- plugins/modules/host_group.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/modules/host_group.py b/plugins/modules/host_group.py index 32c22dd17..5b9eadf30 100644 --- a/plugins/modules/host_group.py +++ b/plugins/modules/host_group.py @@ -340,7 +340,7 @@ def run_module(): type="str", required=False, aliases=["host_group_name"], - deprecated_aliases=[{"name": "host_group_name"}], + deprecated_aliases=[{"name": "host_group_name", "version": "0.15.0", "collection_name": "tribe29"}], ), title=dict(type="str", required=False), groups=dict( @@ -348,7 +348,7 @@ def run_module(): required=False, default=[], aliases=["host_groups"], - deprecated_aliases=[{"name": "host_groups"}], + deprecated_aliases=[{"name": "host_groups", "version": "0.15.0", "collection_name": "tribe29" }], ), state=dict(type="str", default="present", choices=["present", "absent"]), ) From acaeb250a3229b5ce434723574738dabc05379dc Mon Sep 17 00:00:00 2001 From: Michael Sekania Date: Fri, 2 Dec 2022 17:31:31 +0100 Subject: [PATCH 14/22] Fix entries --- plugins/modules/host_group.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/plugins/modules/host_group.py b/plugins/modules/host_group.py index 5b9eadf30..2d1979e0b 100644 --- a/plugins/modules/host_group.py +++ b/plugins/modules/host_group.py @@ -340,7 +340,13 @@ def run_module(): type="str", required=False, aliases=["host_group_name"], - deprecated_aliases=[{"name": "host_group_name", "version": "0.15.0", "collection_name": "tribe29"}], + deprecated_aliases=[ + { + "name": "host_group_name", + "date": "2024-01-01", + "collection_name": "tribe29.checkmk", + } + ], ), title=dict(type="str", required=False), groups=dict( @@ -348,7 +354,13 @@ def run_module(): required=False, default=[], aliases=["host_groups"], - deprecated_aliases=[{"name": "host_groups", "version": "0.15.0", "collection_name": "tribe29" }], + deprecated_aliases=[ + { + "name": "host_groups", + "date": "2024-01-01", + "collection_name": "tribe29.checkmk", + } + ], ), state=dict(type="str", default="present", choices=["present", "absent"]), ) From e1cfde80a2b4a065075336a638c2c8051d0f5d3b Mon Sep 17 00:00:00 2001 From: Robin Gierse Date: Tue, 6 Dec 2022 15:56:07 +0100 Subject: [PATCH 15/22] Bugfix changelog. --- CHANGELOG.rst | 2 +- changelogs/archive/0.13.0/new-passwd-hashing.yml | 2 +- changelogs/changelog.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9f4554e11..f0e8ecaf9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,7 +16,7 @@ Major Changes Minor Changes ------------- -- Agent role - Now supports new password hashing according to L(Werk 14391,https://checkmk.com/werk/14391) +- Agent role - Now supports new password hashing according to Werk 14391: https://checkmk.com/werk/14391 v0.12.0 ======= diff --git a/changelogs/archive/0.13.0/new-passwd-hashing.yml b/changelogs/archive/0.13.0/new-passwd-hashing.yml index 78de6fb58..6791345f3 100644 --- a/changelogs/archive/0.13.0/new-passwd-hashing.yml +++ b/changelogs/archive/0.13.0/new-passwd-hashing.yml @@ -1,7 +1,7 @@ # https://docs.ansible.com/ansible/latest/community/development_process.html#changelogs-how-to minor_changes: - - Agent role - Now supports new password hashing according to L(Werk 14391,https://checkmk.com/werk/14391) + - Agent role - Now supports new password hashing according to Werk 14391: https://checkmk.com/werk/14391 ## Line Format diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 4f00e9db3..1995a04fc 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -117,7 +117,7 @@ releases: major_changes: - Add service_group module. minor_changes: - - Agent role - Now supports new password hashing according to L(Werk 14391,https://checkmk.com/werk/14391) + - Agent role - Now supports new password hashing according to Werk 14391: https://checkmk.com/werk/14391 fragments: - new-passwd-hashing.yml - service_group_module.yml From d269ce504bc14db594e68b06c0cb470de964ea49 Mon Sep 17 00:00:00 2001 From: Robin Gierse Date: Tue, 6 Dec 2022 16:10:56 +0100 Subject: [PATCH 16/22] Add missing default. --- plugins/modules/service_group.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/service_group.py b/plugins/modules/service_group.py index 438ba2bf7..32c10b7bf 100644 --- a/plugins/modules/service_group.py +++ b/plugins/modules/service_group.py @@ -340,7 +340,7 @@ def run_module(): automation_secret=dict(type="str", required=True, no_log=True), name=dict(type="str", required=False), title=dict(type="str", required=False), - groups=dict(type="raw", required=False), + groups=dict(type="raw", required=False, default=[]), state=dict(type="str", default="present", choices=["present", "absent"]), ) From dcda6ac50a844c315531a010de81ae02da9d3e7d Mon Sep 17 00:00:00 2001 From: Michael Sekania Date: Tue, 6 Dec 2022 16:32:24 +0100 Subject: [PATCH 17/22] Change date in deprecated_aliases --- plugins/modules/host_group.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/modules/host_group.py b/plugins/modules/host_group.py index 2d1979e0b..91526da98 100644 --- a/plugins/modules/host_group.py +++ b/plugins/modules/host_group.py @@ -343,7 +343,7 @@ def run_module(): deprecated_aliases=[ { "name": "host_group_name", - "date": "2024-01-01", + "date": "2023-03-01", "collection_name": "tribe29.checkmk", } ], @@ -357,7 +357,7 @@ def run_module(): deprecated_aliases=[ { "name": "host_groups", - "date": "2024-01-01", + "date": "2023-03-01", "collection_name": "tribe29.checkmk", } ], From 3c4e9db876285133f43fefe02af4abef1906efbd Mon Sep 17 00:00:00 2001 From: Robin Gierse Date: Tue, 6 Dec 2022 16:52:36 +0100 Subject: [PATCH 18/22] Add missing modules to README. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 1e2d6268c..c55bc1fe7 100644 --- a/README.md +++ b/README.md @@ -62,11 +62,15 @@ Name | Description Name | Description | Tests --- | --- | --- [tribe29.checkmk.activation](https://github.com/tribe29/ansible-collection-tribe29.checkmk/blob/main/plugins/modules/activation.py)|Activate changes.|[![Integration Tests for Activation Module](https://github.com/tribe29/ansible-collection-tribe29.checkmk/actions/workflows/ans-int-test-activation.yaml/badge.svg)](https://github.com/tribe29/ansible-collection-tribe29.checkmk/actions/workflows/ans-int-test-activation.yaml) +[tribe29.checkmk.contact_group](https://github.com/tribe29/ansible-collection-tribe29.checkmk/blob/main/plugins/modules/contact_group.py)|Manage contact groups.|[![Integration Tests for Contact Group Module](https://github.com/tribe29/ansible-collection-tribe29.checkmk/actions/workflows/ans-int-test-contact_group.yaml/badge.svg)](https://github.com/tribe29/ansible-collection-tribe29.checkmk/actions/workflows/ans-int-test-contact_group.yaml) [tribe29.checkmk.discovery](https://github.com/tribe29/ansible-collection-tribe29.checkmk/blob/main/plugins/modules/discovery.py)|Discover services on hosts.|[![Integration Tests for Discovery Module](https://github.com/tribe29/ansible-collection-tribe29.checkmk/actions/workflows/ans-int-test-discovery.yaml/badge.svg)](https://github.com/tribe29/ansible-collection-tribe29.checkmk/actions/workflows/ans-int-test-discovery.yaml) [tribe29.checkmk.downtime](https://github.com/tribe29/ansible-collection-tribe29.checkmk/blob/main/plugins/modules/downtime.py)|Schedule downtimes on hosts and services.|[![Integration Tests for Downtime Module](https://github.com/tribe29/ansible-collection-tribe29.checkmk/actions/workflows/ans-int-test-downtime.yaml/badge.svg)](https://github.com/tribe29/ansible-collection-tribe29.checkmk/actions/workflows/ans-int-test-downtime.yaml) [tribe29.checkmk.folder](https://github.com/tribe29/ansible-collection-tribe29.checkmk/blob/main/plugins/modules/folder.py)|Manage folders.|[![Integration Tests for Folder Module](https://github.com/tribe29/ansible-collection-tribe29.checkmk/actions/workflows/ans-int-test-folder.yaml/badge.svg)](https://github.com/tribe29/ansible-collection-tribe29.checkmk/actions/workflows/ans-int-test-folder.yaml) +[tribe29.checkmk.host_group](https://github.com/tribe29/ansible-collection-tribe29.checkmk/blob/main/plugins/modules/host_group.py)|Manage host groups.|[![Integration Tests for Host Group Module](https://github.com/tribe29/ansible-collection-tribe29.checkmk/actions/workflows/ans-int-test-host_group.yaml/badge.svg)](https://github.com/tribe29/ansible-collection-tribe29.checkmk/actions/workflows/ans-int-test-host_group.yaml) [tribe29.checkmk.host](https://github.com/tribe29/ansible-collection-tribe29.checkmk/blob/main/plugins/modules/host.py)|Manage hosts.|[![Integration Tests for Host Module](https://github.com/tribe29/ansible-collection-tribe29.checkmk/actions/workflows/ans-int-test-host.yaml/badge.svg)](https://github.com/tribe29/ansible-collection-tribe29.checkmk/actions/workflows/ans-int-test-host.yaml) [tribe29.checkmk.rule](https://github.com/tribe29/ansible-collection-tribe29.checkmk/blob/main/plugins/modules/rule.py)|Manage rules.|[![Integration Tests for Rule Module](https://github.com/tribe29/ansible-collection-tribe29.checkmk/actions/workflows/ans-int-test-rule.yaml/badge.svg)](https://github.com/tribe29/ansible-collection-tribe29.checkmk/actions/workflows/ans-int-test-rule.yaml) +[tribe29.checkmk.service_group](https://github.com/tribe29/ansible-collection-tribe29.checkmk/blob/main/plugins/modules/service_group.py)|Manage service groups.|[![Integration Tests for Service Group Module](https://github.com/tribe29/ansible-collection-tribe29.checkmk/actions/workflows/ans-int-test-service_group.yaml/badge.svg)](https://github.com/tribe29/ansible-collection-tribe29.checkmk/actions/workflows/ans-int-test-service_group.yaml) +[tribe29.checkmk.tag_group](https://github.com/tribe29/ansible-collection-tribe29.checkmk/blob/main/plugins/modules/tag_group.py)|Manage tag groups.|[![Integration Tests for Tag Group Module](https://github.com/tribe29/ansible-collection-tribe29.checkmk/actions/workflows/ans-int-test-tag_group.yaml/badge.svg)](https://github.com/tribe29/ansible-collection-tribe29.checkmk/actions/workflows/ans-int-test-tag_group.yaml) ### Roles Name | Description | Tests From 036dec0913673a21aedc5389cd412b2dcf9fd960 Mon Sep 17 00:00:00 2001 From: Robin Gierse Date: Tue, 6 Dec 2022 16:53:10 +0100 Subject: [PATCH 19/22] Prepare release 0.14.0. --- galaxy.yml | 2 +- requirements.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/galaxy.yml b/galaxy.yml index 64514ef26..d17fc3409 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -10,7 +10,7 @@ name: checkmk # The version of the collection. Must be compatible with semantic versioning -version: 0.13.0 +version: 0.14.0 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md diff --git a/requirements.yml b/requirements.yml index 87e17d41d..6c6465b5e 100644 --- a/requirements.yml +++ b/requirements.yml @@ -1,4 +1,4 @@ --- collections: - name: tribe29.checkmk - version: 0.13.0 + version: 0.14.0 From 7cc2ebbc6604fdb612d5b40e230cb76311554699 Mon Sep 17 00:00:00 2001 From: Robin Gierse Date: Tue, 6 Dec 2022 16:54:31 +0100 Subject: [PATCH 20/22] Add tags to make collection better discoverable. --- galaxy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galaxy.yml b/galaxy.yml index d17fc3409..b04b26140 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -37,7 +37,7 @@ license_file: LICENSE # A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character # requirements as 'namespace' and 'name' -tags: [tribe29, checkmk, monitoring] +tags: [tribe29, checkmk, monitoring, check_mk, check, discovery] # Collections that this collection requires to be installed for it to be usable. The key of the dict is the # collection label 'namespace.name'. The value is a version range From e23e225d376983df66eca7435e687a5deace4c9b Mon Sep 17 00:00:00 2001 From: Robin Gierse Date: Tue, 6 Dec 2022 17:00:13 +0100 Subject: [PATCH 21/22] Update compatibility matrix. --- SUPPORT.md | 1 + 1 file changed, 1 insertion(+) diff --git a/SUPPORT.md b/SUPPORT.md index 1c5e3b9db..3d818e061 100644 --- a/SUPPORT.md +++ b/SUPPORT.md @@ -15,3 +15,4 @@ Collection Version | Checkmk Versions | Remarks --- | --- | --- 0.12.0 | 2.1.0p11, 2.0.0p28 | None 0.13.0 | 2.1.0p17, 2.0.0p31 | None +0.14.0 | 2.1.0p17, 2.0.0p31 | None From 2518769faa25840c81cb6faa53e38b298e875967 Mon Sep 17 00:00:00 2001 From: Robin Gierse Date: Tue, 6 Dec 2022 17:00:29 +0100 Subject: [PATCH 22/22] Clarify security policy. --- SECURITY.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index abc869ba9..1ec64c41c 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,9 +1,12 @@ # Security Policy +## Disambiguation +This policy solely applies to the Checkmk Ansible Collection, not Checkmk itself! +For Checkmk itself, please refer to [this Vulnerability disclosure policy](https://checkmk.com/responsible-disclosure-policy) ## Supported Versions Please always use the latest available version! -Versions in here are used solely for stability, so your Ansible configuration +Versions in this repository are used solely for stability, so your Ansible configuration does not break. However, we cannot and will not support older versions, especially security-wise. If you find a vulnerability, please report it as stated below,