diff options
author | Kenny Woodson <kwoodson@redhat.com> | 2015-04-01 16:45:02 -0400 |
---|---|---|
committer | Kenny Woodson <kwoodson@redhat.com> | 2015-04-01 16:45:02 -0400 |
commit | 59e69dd21c19bf745392b5e83bd652630ee870cc (patch) | |
tree | 7f95f5254e9e9c2ed6adf4ba96e18bf23d7e288e /playbooks | |
parent | 5f0b024fedc826722306c159bbf91a3c74ec3b4e (diff) | |
parent | fe878255f5ac57e75a87bc2af58cedbd21d43501 (diff) | |
download | openshift-59e69dd21c19bf745392b5e83bd652630ee870cc.tar.gz openshift-59e69dd21c19bf745392b5e83bd652630ee870cc.tar.bz2 openshift-59e69dd21c19bf745392b5e83bd652630ee870cc.tar.xz openshift-59e69dd21c19bf745392b5e83bd652630ee870cc.zip |
Merge pull request #135 from kwoodson/zabbix_module
Adding zabbix ansible module with a generic playbook example to fetch problem triggers. Also added oo_flatten to filters.
Diffstat (limited to 'playbooks')
l--------- | playbooks/adhoc/noc/filter_plugins | 1 | ||||
-rw-r--r-- | playbooks/adhoc/noc/get_zabbix_problems.yml | 39 | ||||
l--------- | playbooks/adhoc/noc/library | 1 |
3 files changed, 41 insertions, 0 deletions
diff --git a/playbooks/adhoc/noc/filter_plugins b/playbooks/adhoc/noc/filter_plugins new file mode 120000 index 000000000..99a95e4ca --- /dev/null +++ b/playbooks/adhoc/noc/filter_plugins @@ -0,0 +1 @@ +../../../filter_plugins
\ No newline at end of file diff --git a/playbooks/adhoc/noc/get_zabbix_problems.yml b/playbooks/adhoc/noc/get_zabbix_problems.yml new file mode 100644 index 000000000..6ac5cdcf7 --- /dev/null +++ b/playbooks/adhoc/noc/get_zabbix_problems.yml @@ -0,0 +1,39 @@ +--- +- name: 'Get current hosts who have triggers that are alerting by trigger description' + hosts: localhost + gather_facts: no + tasks: + - assert: + that: oo_desc is defined + + - zbxapi: + server: https://noc2.ops.rhcloud.com/zabbix/api_jsonrpc.php + zbx_class: Trigger + action: get + params: + only_true: true + output: extend + selectHosts: extend + searchWildCardsEnabled: 1 + search: + description: "{{ oo_desc }}" + register: problems + + - debug: var=problems + + - set_fact: + problem_hosts: "{{ problems.results | oo_collect(attribute='hosts') | oo_flatten | oo_collect(attribute='host') | difference(['aggregates']) }}" + + - debug: var=problem_hosts + + - add_host: + name: "{{ item }}" + groups: problem_hosts_group + with_items: problem_hosts + +- name: "Run on problem hosts" + hosts: problem_hosts_group + gather_facts: no + tasks: + - command: "{{ oo_cmd }}" + when: oo_cmd is defined diff --git a/playbooks/adhoc/noc/library b/playbooks/adhoc/noc/library new file mode 120000 index 000000000..ba40d2f56 --- /dev/null +++ b/playbooks/adhoc/noc/library @@ -0,0 +1 @@ +../../../library
\ No newline at end of file |