Skip to content

Commit

Permalink
Merge pull request #462 from Checkmk/devel
Browse files Browse the repository at this point in the history
Release 3.4.0
  • Loading branch information
robin-checkmk authored Nov 9, 2023
2 parents f14c008 + 25e9721 commit ca0aa63
Show file tree
Hide file tree
Showing 64 changed files with 869 additions and 249 deletions.
2 changes: 2 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ exclude_paths:
# requirements, like avoiding python identifiers. To disable add `var-naming`
# to skip_list.
# var_naming_pattern: "^[a-z_][a-z0-9_]*$"
var_naming_pattern: "^checkmk_(server|agent)_.*$"

use_default_rules: true
# Load custom rules from this specific folder
Expand All @@ -41,6 +42,7 @@ use_default_rules: true
skip_list:
- experimental
- name[template] # https://ansible-lint.readthedocs.io/rules/name/
- var-naming[no-role-prefix] # We do believe, that our naming which exceeds this rules requirements is sound

# # Any rule that has the 'opt-in' tag will not be loaded unless its 'id' is
# # mentioned in the enable_list:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ans-int-test-lkp-folder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ans-int-test-lkp-folders.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ans-int-test-lkp-host.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ans-int-test-lkp-hosts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/ansible-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ on:
- devel
paths:
- 'roles/**'
- 'playbooks/**'
pull_request:
branches:
- main
- devel
paths:
- 'roles/**'
- 'playbooks/**'

jobs:

Expand Down Expand Up @@ -58,12 +60,12 @@ jobs:

# Run the linting
- name: Run yamllint on roles
run: yamllint -c .yamllint roles/
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
run: yamllint -c ./${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/.yamllint ./${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/roles/
working-directory: ./ansible_collections/

- name: Run yamllint on playbooks
run: yamllint -c .yamllint playbooks/
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
run: yamllint -c ./${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/.yamllint ./${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/playbooks/
working-directory: ./ansible_collections/

- name: Run ansible-lint on roles
run: ansible-lint -c ${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/.ansible-lint ${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/roles/
Expand Down
1 change: 1 addition & 0 deletions SUPPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ Collection Version | Checkmk Versions | Ansible Versions | Remarks
3.1.0 | 2.0.0p38, 2.1.0p32, 2.2.0p7 | 2.13, 2.14, 2.15 | None
3.2.0 | 2.0.0p38, 2.1.0p32, 2.2.0p8 | 2.13, 2.14, 2.15 | None
3.3.0 | 2.0.0p39, 2.1.0p35, 2.2.0p12 | 2.13, 2.14, 2.15 | None
3.4.0 | 2.0.0p39, 2.1.0p36, 2.2.0p14 | 2.12, 2.14, 2.15 | None
2 changes: 1 addition & 1 deletion changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -722,4 +722,4 @@ releases:
- description: Get various information about a host
name: hosts
namespace: null
release_date: '2023-10-26'
release_date: '2023-11-02'
5 changes: 5 additions & 0 deletions changelogs/fragments/agent_push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
minor_changes:
- Agent role - Introduce variable to configure agent mode. Refer to the README.

bugfixes:
- Agent role - Fix agent port check for agent modes other than "pull".
6 changes: 6 additions & 0 deletions changelogs/fragments/cme_support.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
minor_changes:
- User module - Add support for the Checkmk Managed Edition (CME).
- Service group module - Add support for the Checkmk Managed Edition (CME).
- Password module - Add support for the Checkmk Managed Edition (CME).
- Host group module - Add support for the Checkmk Managed Edition (CME).
- Contact group module - Add support for the Checkmk Managed Edition (CME).
3 changes: 3 additions & 0 deletions changelogs/fragments/no_log.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- Agent role - Avoid logging passwords by default for extra security
- Server role - Avoid logging passwords by default for extra security
1 change: 1 addition & 0 deletions changelogs/fragments/release_summary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
release_summary: "Supporting managed service providers, admins and security. All in one release."
3 changes: 3 additions & 0 deletions changelogs/fragments/server-omd-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- Server role - Enable configuration of omd config values. Refer to the README for details.
- Server role - Add new states "enabled" and "disabled" for site management.
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ name: general

# The version of the collection. Must be compatible with semantic versioning

version: 3.3.0
version: 3.4.0

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md
Expand Down
55 changes: 42 additions & 13 deletions plugins/modules/contact_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
title:
description: The title (alias) of your contact group. If omitted defaults to the name.
type: str
customer:
description: For the Checkmk Managed Edition (CME), you need to specify which customer ID this object belongs to.
required: false
type: str
groups:
description:
- instead of 'name', 'title' a list of dicts with elements of contact group name and title (alias) to be created/modified/deleted.
Expand Down Expand Up @@ -60,6 +64,7 @@
automation_secret: "$SECRET"
name: "my_contact_group"
title: "My Contact Group"
customer: "provider"
state: "present"
# Create several contact groups.
Expand All @@ -69,6 +74,7 @@
site: "my_site"
automation_user: "automation"
automation_secret: "$SECRET"
customer: "provider"
groups:
- name: "my_contact_group_one"
title: "My Contact Group One"
Expand All @@ -85,6 +91,7 @@
site: "my_site"
automation_user: "automation"
automation_secret: "$SECRET"
customer: "provider"
groups:
- name: "my_contact_group_one"
title: "My Contact Group One"
Expand Down Expand Up @@ -266,10 +273,17 @@ def create_single_contact_group(module, base_url, headers):
name = module.params["name"]

api_endpoint = "/domain-types/contact_group_config/collections/all"
params = {
"name": name,
"alias": module.params.get("title", name),
}
if module.params.get("customer") is not None:
params = {
"name": name,
"alias": module.params.get("title", name),
"customer": module.params.get("customer", "provider"),
}
else:
params = {
"name": name,
"alias": module.params.get("title", name),
}
url = base_url + api_endpoint

response, info = fetch_url(
Expand All @@ -286,15 +300,29 @@ def create_single_contact_group(module, base_url, headers):

def create_contact_groups(module, base_url, groups, headers):
api_endpoint = "/domain-types/contact_group_config/actions/bulk-create/invoke"
params = {
"entries": [
{
"name": el.get("name"),
"alias": el.get("title", el.get("name")),
}
for el in groups
],
}

if module.params.get("customer") is not None:
params = {
"entries": [
{
"name": el.get("name"),
"alias": el.get("title", el.get("name")),
"customer": el.get("customer", "provider"),
}
for el in groups
],
}
else:
params = {
"entries": [
{
"name": el.get("name"),
"alias": el.get("title", el.get("name")),
}
for el in groups
],
}

url = base_url + api_endpoint

response, info = fetch_url(
Expand Down Expand Up @@ -351,6 +379,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),
customer=dict(type="str", required=False),
groups=dict(type="raw", required=False, default=[]),
state=dict(type="str", default="present", choices=["present", "absent"]),
)
Expand Down
55 changes: 42 additions & 13 deletions plugins/modules/host_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
title:
description: The title (alias) of your host group. If omitted defaults to the name.
type: str
customer:
description: For the Checkmk Managed Edition (CME), you need to specify which customer ID this object belongs to.
required: false
type: str
groups:
description:
- instead of 'name', 'title' a list of dicts with elements of host group name and title (alias) to be created/modified/deleted.
Expand All @@ -56,6 +60,7 @@
automation_secret: "$SECRET"
name: "my_host_group"
title: "My Host Group"
customer: "provider"
state: "present"
# Create several host groups.
Expand All @@ -65,6 +70,7 @@
site: "my_site"
automation_user: "automation"
automation_secret: "$SECRET"
customer: "provider"
groups:
- name: "my_host_group_one"
title: "My Host Group One"
Expand All @@ -81,6 +87,7 @@
site: "my_site"
automation_user: "automation"
automation_secret: "$SECRET"
customer: "provider"
groups:
- name: "my_host_group_one"
title: "My Host Group One"
Expand Down Expand Up @@ -262,10 +269,17 @@ def create_single_host_group(module, base_url, headers):
name = module.params["name"]

api_endpoint = "/domain-types/host_group_config/collections/all"
params = {
"name": name,
"alias": module.params.get("title", name),
}
if module.params.get("customer") is not None:
params = {
"name": name,
"alias": module.params.get("title", name),
"customer": module.params.get("customer", "provider"),
}
else:
params = {
"name": name,
"alias": module.params.get("title", name),
}
url = base_url + api_endpoint

response, info = fetch_url(
Expand All @@ -282,15 +296,29 @@ def create_single_host_group(module, base_url, headers):

def create_host_groups(module, base_url, groups, headers):
api_endpoint = "/domain-types/host_group_config/actions/bulk-create/invoke"
params = {
"entries": [
{
"name": el.get("name"),
"alias": el.get("title", el.get("name")),
}
for el in groups
],
}

if module.params.get("customer") is not None:
params = {
"entries": [
{
"name": el.get("name"),
"alias": el.get("title", el.get("name")),
"customer": el.get("customer", "provider"),
}
for el in groups
],
}
else:
params = {
"entries": [
{
"name": el.get("name"),
"alias": el.get("title", el.get("name")),
}
for el in groups
],
}

url = base_url + api_endpoint

response, info = fetch_url(
Expand Down Expand Up @@ -350,6 +378,7 @@ def run_module():
required=False,
),
title=dict(type="str", required=False),
customer=dict(type="str", required=False),
groups=dict(
type="raw",
required=False,
Expand Down
Loading

0 comments on commit ca0aa63

Please sign in to comment.