This page shows how to quickly deploy the Check_MK agent using Ansible.


Standard Ansible role from 2015, deploys plugins and sets up sudo / ssh

Please use the above if you already know Ansible ;)




Install Ansible

# apt-get install ansible # Debian / Ubuntu


SSH Setup:

Create a SSH Key & copy the key

# ssh-keygen -t dsa -f ~/.ssh/id_dsa-ansible
# Enter a Passphrase for this key!!!

Use SSH-Agent & SSH-Add(key)

# ssh-agent bash
# ssh-add ~/.ssh/id_dsa-ansible

Create an ansible inventory:

I think the best way would be to hook into Check_MK and pull out all hosts that have the "tcp" flag.

The following shell command does it.

cmk --list-tag tcp

Alternatively, might be a good place.



View of the Playbook

(current version, will edit more)

The goal is to fetch the newest agent version and deploy it anywhere but on Ubuntu / ARM systems. (On super-modern ARM systems the /proc/cpuinfo output is different and the default agent would not work)

- hosts: all
  user: root
  - name: copy Check_MK Agent
    get_url: url=";a=blob_plain;f=agents/check_mk_agent.linux;hb=HEAD" dest=/usr/bin/check_mk_agent mode=700 thirsty=yes
    only_if: "'$ansible_system' == 'Linux' and '$ansible_architecture' != 'armv7l'"

I found out two things:

ansible_system.lower() didn't work, get_url is not ideal: it can't "replace only if different", this is why i've gone with the following for my example:

- hosts: all
  user: root
  - name: copy Check_MK Agent
    copy: src=files/check_mk_agent.linux dest=/usr/bin/check_mk_agent mode=700 owner=root group=root backup=yes
    only_if: "'$ansible_system' == 'Linux' and '$ansible_architecture' != 'armv7l'"


dependencies via yum / apt

(move into playbook)

# ansible -m apt -a pkg=ethtool state=latest


Test agent access

(can also happily from the cookbook)

# cmk -d



If there weren't so many ignorant people in the world, this document would be complete already. Instead I've had one more pointless discussion with some autistic nerd that finds himself unable to answer a question if he spotted an error with a detail, which, as sugar on top, would not even matter due to the nature of the question which he would have seen if he were able to read the whole.

Guys, make the world a better place and take your meds.