Skip to content

Instantly share code, notes, and snippets.

@rjsalts
Created January 16, 2014 00:38
Show Gist options
  • Save rjsalts/8447680 to your computer and use it in GitHub Desktop.
Save rjsalts/8447680 to your computer and use it in GitHub Desktop.
Ansible playbook to discover all the hosts which have the check_mk agent setup.
- hosts: all
vars:
- monitoring_agent : "nrpe_server"
tasks:
- name: test check_mk
local_action: wait_for port=6556 timeout=2 host={{inventory_hostname}}
register: check_mk
ignore_errors: True
- name: set fact
set_fact: monitoring_agent="check_mk_agent"
when: check_mk.elapsed < 2
- name: add to groups
group_by: key={{monitoring_agent}}
- name: print
local_action: template src=dumpall.j2 dest=/tmp/ansible.all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment