Git Product home page Git Product logo

Comments (10)

RafaelKr avatar RafaelKr commented on September 23, 2024 1

Hmmm that's a good question. The files which should be run seem to be created on my local machine.
There should be no firewall blocking it. From my machine I can connect to the checkmk server, its dashboard and also the agent host. (443 and 22 both are open).
Can I maybe somehow add a code line to debug where it hangs up?

checkmk_agent_server is the server where checkmk is running on, not the server where the agent is installed, correct?

from ansible-collection-checkmk.general.

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

Thanks for confirming!

Yes, the release 0.11.0 will hit the galaxy today, and it is already packed, so I will put this fix in the next release.

from ansible-collection-checkmk.general.

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

The task to register the host runs on the host, that got the agent installed, or on your Ansible controller?
Can you confirm, that there is no firewall preventing communication? Because it looks like there is a dropping firewall in between.

from ansible-collection-checkmk.general.

RafaelKr avatar RafaelKr commented on September 23, 2024

Also the previous step tribe29.checkmk.agent : Debian Derivates: Install Checkmk CRE Agent. is running correctly. The agent is installed on the target host.

from ansible-collection-checkmk.general.

RafaelKr avatar RafaelKr commented on September 23, 2024

This is my current full playbook.yaml

- hosts: default
  remote_user: ansible
  become: yes

  vars:
    checkmk_agent_version: "2.1.0p12"
    checkmk_agent_edition: cre
    checkmk_agent_protocol: https
    checkmk_agent_server: checkmk.example.com
    checkmk_agent_site: monitoring
    checkmk_agent_user: automation
    checkmk_agent_secret: '<MY_SECRET>'
    checkmk_agent_add_host: 'true'
    checkmk_agent_discover: 'true'
    checkmk_agent_folder: 'My Folder'

  vars_prompt:
    - name: "ansible_sudo_pass"
      prompt: "[sudo] password for {{ target_user }}"
      private: yes

  roles:
    - tribe29.checkmk.agent
    - setup-monitoring

Maybe its related to

- hosts: default
  remote_user: ansible
  become: yes

from ansible-collection-checkmk.general.

RafaelKr avatar RafaelKr commented on September 23, 2024

I got something, when I go to /home/my_user.ansible/collections/ansible_collections/tribe29/checkmk/roles/agent/tasks/main.yaml on my local machine and set become_user: my_user on all tasks where delegate_to is set it works!

Although it doesn't find my folder. Maybe because of the space? It's like checkmk_agent_folder: 'My Folder'

Edit:
"msg": "Error calling API. HTTP code 400. Details: b'{\"title\": \"Bad Request\", \"status\": 400, \"detail\": \"These fields have problems: target_folder\", \"fields\": {\"target_folder\": [\"The folder \\'/My Folder\\' could not be found.\"]}}', "

Got it, folder must be my_folder

from ansible-collection-checkmk.general.

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

I think it is relevant, where you run the registration task. But by default the role will run from the host, where the agent was just installed. So you want to make sure, that that host can talk to the Checkmk server.

from ansible-collection-checkmk.general.

RafaelKr avatar RafaelKr commented on September 23, 2024

I now got a working solution, it's fixed when explicitly adding become: false to these both tasks (the ones using delegate_to: localhost):
https://github.com/tribe29/ansible-collection-tribe29.checkmk/blob/96b0a246970939ba2174b8a9ef8279809f8b6272/roles/agent/tasks/main.yml#L35-L51
https://github.com/tribe29/ansible-collection-tribe29.checkmk/blob/96b0a246970939ba2174b8a9ef8279809f8b6272/roles/agent/tasks/main.yml#L103-L113

It wasn't working because ansible tried to connect with SSH to my local machine with the user ansible. Because I did set become: yes and remote_user: ansible on "global" level of my own playbook.
With the explicit become: false on the mentioned tasks this global config on my side is ignored.
Maybe this should be added to all places where delegate_to: localhost is used.

from ansible-collection-checkmk.general.

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

This is generally fixed by #169.
It might be necessary to double-check one's configuration, but with the added become: false the role should work out of the box.

from ansible-collection-checkmk.general.

RafaelKr avatar RafaelKr commented on September 23, 2024

Checked the changes from the PR locally, its working for my case. Thanks!
In my last comment I stated I've added become: false to tribe29.checkmk.discovery. In the PR this wasn't changed and indeed, it is not required.

BTW in #169 (comment) you wrote it will be merged for 0.12.0 but the next version would be 0.11.0. Did you mean that?

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.