From e87b1e5e86ee30b9c8f8df93a50183ad2bc7e20f Mon Sep 17 00:00:00 2001 From: Robin Gierse Date: Mon, 23 Sep 2024 10:45:48 +0200 Subject: [PATCH] Update documentation. --- CODEOWNERS | 1 + README.md | 10 ++++---- changelogs/fragments/checkmk.yml | 2 +- plugins/inventory/checkmk.py | 44 +++++++++----------------------- 4 files changed, 19 insertions(+), 38 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index 7ae68dc25..e604b648d 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -2,6 +2,7 @@ /tests/ @robin-checkmk /roles/ @robin-checkmk /playbooks/ @robin-checkmk +/plugins/inventory/ @Max-checkmk /plugins/lookup/version.py @lgetwan /plugins/modules/ @lgetwan /plugins/module_utils/ @godspeed-you diff --git a/README.md b/README.md index 891e52658..7868ddfd1 100644 --- a/README.md +++ b/README.md @@ -38,11 +38,11 @@ For any form of support queries or requests refer to [SUPPORT.md](SUPPORT.md). You can find playbooks, demonstrating the content of this collection in the folder [playbooks/demo/](playbooks/demo/). - +### Inventory plugins + +Name | Description | Tests +--- | --- | --- +[checkmk.general.checkmk](https://github.com/Checkmk/ansible-collection-checkmk.general/blob/main/plugins/inventory/checkmk.py)|Dynamic Inventory Source for Checkmk | [![Ansible Unit Test for Inventory Module](https://github.com/Checkmk/ansible-collection-checkmk.general/actions/workflows/ans-unit-test-inventory.yaml/badge.svg)](https://github.com/Checkmk/ansible-collection-checkmk.general/actions/workflows/ans-unit-test-inventory.yaml) ### Lookup plugins Click on the lookup plugin name below, to get detailed documentation about it. diff --git a/changelogs/fragments/checkmk.yml b/changelogs/fragments/checkmk.yml index 89abb7919..adf4e8c70 100644 --- a/changelogs/fragments/checkmk.yml +++ b/changelogs/fragments/checkmk.yml @@ -1,2 +1,2 @@ major_changes: - - Inventory module - Added module for creating an dynamic inventory with Checkmk as source. + - Inventory module - Add module for creating a dynamic inventory from Checkmk. diff --git a/plugins/inventory/checkmk.py b/plugins/inventory/checkmk.py index 1968cb657..e4a1cd9fd 100644 --- a/plugins/inventory/checkmk.py +++ b/plugins/inventory/checkmk.py @@ -9,43 +9,19 @@ DOCUMENTATION = """ name: checkmk author: Max Sickora (@max-checkmk) - short_description: checkmk inventory source + short_description: Dynamic Inventory Source or Checkmk description: - Get hosts from any checkmk site. - - Get groups from hosttags and sites from checkmk. - options: - server_url: - description: URL of the Checkmk server - required: true - type: string - - site: - description: Site name. - required: true - type: string - - automation_user: - description: Automation user for the REST API access. - required: true - type: string - - automation_secret: - description: Automation secret for the REST API access. - required: true - type: string + - Generate groups based on tag groups or sites in Checkmk. - validate_certs: - description: Whether or not to validate TLS certificates. - type: boolean - required: false - default: True + extends_documentation_fragment: [checkmk.general.common] + options: plugin: - description: Name of the plugin. Should always be C(checkmk.general.checkmk) + description: Name of the plugin. Should always be C(checkmk.general.checkmk). type: string required: true choices: ['checkmk.general.checkmk'] - groupsources: description: - List of sources for grouping @@ -56,12 +32,16 @@ """ EXAMPLES = """ -# Getting all hosts incl. hosttags and sites as groups +# To get started, you need to create a file called `checkmk.yml`, which contains +# one of the example blocks below and use it as your inventory source. +# E.g., with `ansible-inventory -i checkmk.yml --graph`. + +# Group all hosts based on both tag groups and sites: plugin: checkmk.general.checkmk server_url: "http://hostname/" site: "sitename" -user: "cmkadmin" -secret: "******" +automation_user: "cmkadmin" +automation_secret: "******" validate_certs: False groupsources: ["hosttags", "sites"] """