Giter Club home page Giter Club logo

Comments (18)

muehlings avatar muehlings commented on June 16, 2024 1

Second try: #427
I think I fixed most of the request logic against non-CME sites and the diff looks consistent.

from ansible-collection-checkmk.general.

robin-checkmk avatar robin-checkmk commented on June 16, 2024

Note: CME support can affect the agent role too (See #121 for reference). We should keep an eye on that.

from ansible-collection-checkmk.general.

edermi avatar edermi commented on June 16, 2024

I assume CME refers to the CheckMK Enterprise edition? If yes, How is the agent deployment support going? I'd like to avoid having to install the agent on all my systems by hand.

from ansible-collection-checkmk.general.

robin-checkmk avatar robin-checkmk commented on June 16, 2024

Hi @edermi, no CME is the Checkmk Managed Service Edition. This issue focuses on modules, as they need to be able to handle an additional attribute. Regarding your question about the Agent rollout: If you are using the CEE (Enterprise Edition) you are good to go. If you are actually using the CME, I would need to check a thing or two.

from ansible-collection-checkmk.general.

edermi avatar edermi commented on June 16, 2024

Thanks, understood.
The agent README states that CheckMK Enterprise Edition is not supported, hence I was reluctant to try it. I'd like to avoid this issue going off-topic, is there any further documentation? I'm especially interested in how this plays with the bakery and auto-updates.

from ansible-collection-checkmk.general.

robin-checkmk avatar robin-checkmk commented on June 16, 2024

Let's continue in the referenced issue, so we don't clutter this issue. :)

from ansible-collection-checkmk.general.

robin-checkmk avatar robin-checkmk commented on June 16, 2024

#165 adds CME support for the agent role.

from ansible-collection-checkmk.general.

github-actions avatar github-actions commented on June 16, 2024

This issue has been stale for 60 days. It will close in 7 days.

from ansible-collection-checkmk.general.

github-actions avatar github-actions commented on June 16, 2024

This issue has been stale for 60 days. It will close in 7 days.

from ansible-collection-checkmk.general.

github-actions avatar github-actions commented on June 16, 2024

This issue has been stale for 60 days. It will close in 7 days.

from ansible-collection-checkmk.general.

robin-checkmk avatar robin-checkmk commented on June 16, 2024

This is still relevant, hence I marked it to never become stale.

from ansible-collection-checkmk.general.

muehlings avatar muehlings commented on June 16, 2024

I had to patch two modules host_group.py and user.py yesterday for my transition from multiple scripts and manual doings to ansible. Is it correct that Checkmk expects the customer always as lowercase string ("provider" despite the fact it's written "Provider" in my backend)?

Here are my changes (just in case I do a silly update of my local collection):

host_group.py

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),
        "customer": module.params.get("customer", 'provider'),
    }
    url = base_url + api_endpoint

    response, info = fetch_url(
        module, url, module.jsonify(params), headers=headers, method="POST"
    )

    if info["status"] != 200:
        exit_failed(
            module,
            "Error calling API. HTTP code %d. Details: %s, "
            % (info["status"], info["body"]),
        )


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")),
                "customer": el.get("customer", 'provider'),
            }
            for el in groups
        ],
    }
    url = base_url + api_endpoint

    response, info = fetch_url(
        module, url, module.jsonify(params), headers=headers, method="POST"
    )

    if info["status"] != 200:
        exit_failed(
            module,
            "Error calling API (bulk-create). HTTP code %d. Details: %s, "
            % (info["status"], info["body"]),
        )

user.py

def run_module():

    # define available arguments/parameters a user can pass to the module
    module_args = dict(
        server_url=dict(type="str", required=True),
        site=dict(type="str", required=True),
        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(required=True, type="str"),
        fullname=dict(type="str"),
        customer=dict(type="str"),
        password=dict(type="str", no_log=True),
        enforce_password_change=dict(type="bool", no_log=False),

[...]

    @classmethod
    def from_module(cls, params):

        attributes = cls.default_attributes

        attributes["username"] = params["name"]

        def _exists(key):
            return key in params and params[key] is not None

        if _exists("fullname"):
            attributes["fullname"] = params["fullname"]

        if _exists("customer"):
            attributes["customer"] = params["customer"]

from ansible-collection-checkmk.general.

robin-checkmk avatar robin-checkmk commented on June 16, 2024

I had to patch two modules host_group.py and user.py yesterday for my transition from multiple scripts and manual doings to ansible. Is it correct that Checkmk expects the customer always as lowercase string ("provider" despite the fact it's written "Provider" in my backend)?

If you look closely, you will see, that the ID of the customer attribute is actually lower case. Hence, the need for lower case.
image

Thanks for sharing your changes @muehlings! I am certain it helps people get started adapting modules, once they get to it. You might even create your own PRs for the modules you touched, to get a piece of the fame? 😉

from ansible-collection-checkmk.general.

muehlings avatar muehlings commented on June 16, 2024

Hello Robin,

Thanks for sharing your changes @muehlings! I am certain it helps people get started adapting modules, once they get to it. You might even create your own PRs for the modules you touched, to get a piece of the fame? 😉

I still need a workshop for git. ;) In my last PR I lost about 2 hours for linting. That feels inefficient.

from ansible-collection-checkmk.general.

robin-checkmk avatar robin-checkmk commented on June 16, 2024

I still need a workshop for git. ;) In my last PR I lost about 2 hours for linting. That feels inefficient.

We can do that together. :) You create the basic stuff and I figure out linting findings and so on. :)

from ansible-collection-checkmk.general.

muehlings avatar muehlings commented on June 16, 2024

I forked from the wrong branch (:main instead of :devel), but my changes should be noticable. I have done only two modules. There are some more to go and the POST/PUT requests should not submit the parameter "customer". I think they will fail then.

from ansible-collection-checkmk.general.

meni2029 avatar meni2029 commented on June 16, 2024

Hi, just a note to thank you guys to work on adding support for the CME, this will be very very useful to us ! As we are starting to deploy the CME.

from ansible-collection-checkmk.general.

robin-checkmk avatar robin-checkmk commented on June 16, 2024

This is implemented with #427 in release 3.4.0.
If there are follow-up issues, please open a new ticket.

from ansible-collection-checkmk.general.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.