Created
January 16, 2014 00:38
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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