summaryrefslogtreecommitdiffstats
path: root/playbooks/adhoc
diff options
context:
space:
mode:
authorThomas Wiest <twiest@users.noreply.github.com>2015-07-10 14:02:10 -0400
committerThomas Wiest <twiest@users.noreply.github.com>2015-07-10 14:02:10 -0400
commit042aadae4f815b0a5e8fce324b167bf4d6b57878 (patch)
treecde89cad94715e98d475ac440bd9d2fa65327d12 /playbooks/adhoc
parent14bde2f7d99b2a0f01259834135bbdc324bcac70 (diff)
parent1830191258b9148b6ce286fa63d30c41e048a146 (diff)
downloadopenshift-042aadae4f815b0a5e8fce324b167bf4d6b57878.tar.gz
openshift-042aadae4f815b0a5e8fce324b167bf4d6b57878.tar.bz2
openshift-042aadae4f815b0a5e8fce324b167bf4d6b57878.tar.xz
openshift-042aadae4f815b0a5e8fce324b167bf4d6b57878.zip
Merge pull request #337 from kwoodson/create_host
example: create host using ansible zabbix module.
Diffstat (limited to 'playbooks/adhoc')
-rw-r--r--playbooks/adhoc/noc/create_host.yml55
1 files changed, 55 insertions, 0 deletions
diff --git a/playbooks/adhoc/noc/create_host.yml b/playbooks/adhoc/noc/create_host.yml
new file mode 100644
index 000000000..d250e6e69
--- /dev/null
+++ b/playbooks/adhoc/noc/create_host.yml
@@ -0,0 +1,55 @@
+---
+- name: 'Create a host object in zabbix'
+ hosts: localhost
+ gather_facts: no
+ roles:
+ - os_zabbix
+ post_tasks:
+
+ - zbxapi:
+ server: https://noc2.ops.rhcloud.com/zabbix/api_jsonrpc.php
+ zbx_class: Template
+ state: list
+ params:
+ host: ctr_test_kwoodson
+ filter:
+ host:
+ - ctr_kwoodson_test_tmpl
+
+ register: tmpl_results
+
+ - debug: var=tmpl_results
+
+#ansible-playbook -e 'oo_desc=kwoodson test' -e 'oo_name=kwoodson test name' -e 'oo_start=1435715357' -e 'oo_stop=1435718985' -e 'oo_hostids=11549' create_maintenance.yml
+- name: 'Create a host object in zabbix'
+ hosts: localhost
+ gather_facts: no
+ roles:
+ - os_zabbix
+ post_tasks:
+
+ - zbxapi:
+ server: https://noc2.ops.rhcloud.com/zabbix/api_jsonrpc.php
+ zbx_class: Host
+ state: absent
+ params:
+ host: ctr_test_kwoodson
+ interfaces:
+ - type: 1
+ main: 1
+ useip: 1
+ ip: 127.0.0.1
+ dns: ""
+ port: 10050
+ groups:
+ - groupid: 1
+ templates: "{{ tmpl_results.results | oo_collect('templateid') | oo_build_zabbix_list_dict('templateid') }}"
+ output: extend
+ filter:
+ host:
+ - ctr_test_kwoodson
+
+ register: host_results
+
+ - debug: var=host_results
+