Giter VIP home page Giter VIP logo

Comments (4)

peterge-misoft avatar peterge-misoft commented on August 22, 2024 1

I began working on this in #579 and I realized that its a quite complex change regarding the variable checks to introduce for the agent collection.

The best option for me to achive what I want would be to only run this collection when there is no agent installed on the host yet.

This would reduce the amount of times this collections is run dramatically in my setup and would not need any change in the agent collection at all.

Thanks for caring @robin-checkmk and pointing me into the right KISS direction.

from ansible-collection-checkmk.general.

peterge-misoft avatar peterge-misoft commented on August 22, 2024 1

Okay, here is the solution for my problem:

############################################################
# Execute CheckMK Agent Collection & install custom checks #
############################################################

- name: Run checkmk agent role
  hosts: misoft
  tasks:
    - name: Check if CMK agent is installed
      ansible.builtin.shell: dpkg-query -l | grep -q 'check-mk-agent'
      register: cmk_agent_check
      ignore_errors: true
      changed_when: false

    - name: Set fact based on the agent installation state
      ansible.builtin.set_fact:
        cmk_agent_installed: "{{ cmk_agent_check.rc == 0 }}"

    - name: Include custom checks role
      ansible.builtin.include_role:
        name: misoft-role-custom-checkmk-checks

    - name: Include checkmk agent role
      ansible.builtin.include_role:
        name: checkmk.general.agent
      when: not cmk_agent_installed

Yes I achived it in 30 minutes. No idea why I wanted to do this on a much more complex way...

from ansible-collection-checkmk.general.

robin-checkmk avatar robin-checkmk commented on August 22, 2024

Hi @peterge1998, maybe I missed it, but you did not actually explain, what you propose to change, correct?
So I would ask you to either update your description or make it a pull request, so we can discuss the proposal properly.
Thanks!

from ansible-collection-checkmk.general.

peterge1998 avatar peterge1998 commented on August 22, 2024

Hi @peterge1998, maybe I missed it, but you did not actually explain, what you propose to change, correct? So I would ask you to either update your description or make it a pull request, so we can discuss the proposal properly. Thanks!

I created #579, which should implement the behaviour I suggested in my last comment.

But I wonder how I can test my changes, it isnt run by my playbook after copying the folder to roles/ in my ansible dir and defining the folder name in a roles task...

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.