Git Product home page Git Product logo

Comments (3)

muehlings avatar muehlings commented on September 23, 2024

I have tried the devel-branch (https://github.com/tribe29/ansible-collection-tribe29.checkmk/blob/8928a1df37701c863752fce5692b5e17c6ae2b5c/plugins/modules/host.py) and my example tasks are working now.

  • Changing folder and/or ip of the host is working.
  • The state (absent/present) is working.

But the role is missing a line for the state: https://github.com/tribe29/ansible-collection-tribe29.checkmk/blob/8928a1df37701c863752fce5692b5e17c6ae2b5c/roles/agent/tasks/main.yml#L34-L44

Adding state: "{{ checkmk_agent_state | default(omit) }}" after https://github.com/tribe29/ansible-collection-tribe29.checkmk/blob/8928a1df37701c863752fce5692b5e17c6ae2b5c/roles/agent/tasks/main.yml#L43 seems to fix it:
changed: [my_host_with_ip -> localhost] => {"changed": true, "failed_when_result": false, "msg": "Host deleted."}

My inventory now looks like:

my_site: # = Sitename
  hosts:
    host_with_ip:
      ansible_host: 127.0.0.1
      checkmk_agent_host_attributes:
        ipaddress: '{{ansible_host}}'
        tag_custom: "own_custom_tag"
      checkmk_agent_folder: test
      state: present
    my_host_with_ip:
      ansible_host: 127.0.0.2
      checkmk_agent_host_attributes:
        ipaddress: '{{ansible_host}}'
        tag_custom: "own_custom_tag"
      checkmk_agent_folder: test
      state: absent
  vars:
    checkmk_agent_add_host: 'true'
    checkmk_agent_edition: cme
    checkmk_agent_host_ip: '{{ ansible_host }}'
    checkmk_agent_host_name: '{{ inventory_hostname }}'
    checkmk_agent_pass: "$SECRET"
    checkmk_agent_protocol: https
    checkmk_agent_server: localhost
    checkmk_agent_site: my_site
    checkmk_agent_user: automation
    checkmk_agent_version: 2.0.0p23

My playbook now looks like:

---
- hosts: my_site # = Sitename
  connection: local

  roles:
  - tribe29.checkmk.agent

from ansible-collection-checkmk.general.

robin-checkmk avatar robin-checkmk commented on September 23, 2024

@lgetwan can you take a look at the plugin, I cannot seem to get my head around it.

from ansible-collection-checkmk.general.

lgetwan avatar lgetwan commented on September 23, 2024

Fixed with PR #147

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.