summaryrefslogtreecommitdiffstats
path: root/roles/lib_zabbix/tasks
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2015-08-21 17:44:30 -0400
committerKenny Woodson <kwoodson@redhat.com>2015-08-27 14:40:09 -0400
commit693be4802c2b3886b82681c5c1666b9f13d9ca36 (patch)
tree4a6cee11c72601298535c262f5654a4b43ffba14 /roles/lib_zabbix/tasks
parent2f5486c7174eeacdd52938442daa2ddfa6a8e277 (diff)
downloadopenshift-693be4802c2b3886b82681c5c1666b9f13d9ca36.tar.gz
openshift-693be4802c2b3886b82681c5c1666b9f13d9ca36.tar.bz2
openshift-693be4802c2b3886b82681c5c1666b9f13d9ca36.tar.xz
openshift-693be4802c2b3886b82681c5c1666b9f13d9ca36.zip
Updates for zbx ans module
Diffstat (limited to 'roles/lib_zabbix/tasks')
-rw-r--r--roles/lib_zabbix/tasks/create_template.yml61
-rw-r--r--roles/lib_zabbix/tasks/create_user.yml11
2 files changed, 72 insertions, 0 deletions
diff --git a/roles/lib_zabbix/tasks/create_template.yml b/roles/lib_zabbix/tasks/create_template.yml
new file mode 100644
index 000000000..022ca52f2
--- /dev/null
+++ b/roles/lib_zabbix/tasks/create_template.yml
@@ -0,0 +1,61 @@
+---
+- debug: var=template
+
+- name: Template Create Template
+ zbx_template:
+ zbx_server: "{{ server }}"
+ zbx_user: "{{ user }}"
+ zbx_password: "{{ password }}"
+ name: "{{ template.name }}"
+ register: created_template
+
+- debug: var=created_template
+
+- set_fact:
+ lzbx_applications: "{{ template.zitems | oo_select_keys_from_list(['applications']) | oo_flatten | unique }}"
+
+- debug: var=lzbx_applications
+
+- name: Create Application
+ zbx_application:
+ zbx_server: "{{ server }}"
+ zbx_user: "{{ user }}"
+ zbx_password: "{{ password }}"
+ name: "{{ item }}"
+ template_name: "{{ template.name }}"
+ with_items: lzbx_applications
+ register: created_application
+ when: template.zitems is defined
+
+- debug: var=created_application
+
+- name: Create Items
+ zbx_item:
+ zbx_server: "{{ server }}"
+ zbx_user: "{{ user }}"
+ zbx_password: "{{ password }}"
+ key: "{{ item.key }}"
+ name: "{{ item.name | default(item.key, true) }}"
+ value_type: "{{ item.value_type | default('int') }}"
+ template_name: "{{ template.name }}"
+ applications: "{{ item.applications }}"
+ with_items: template.zitems
+ register: created_items
+ when: template.zitems is defined
+
+#- debug: var=ctp_created_items
+
+- name: Create Triggers
+ zbx_trigger:
+ zbx_server: "{{ server }}"
+ zbx_user: "{{ user }}"
+ zbx_password: "{{ password }}"
+ description: "{{ item.description }}"
+ expression: "{{ item.expression }}"
+ priority: "{{ item.priority }}"
+ with_items: template.ztriggers
+ when: template.ztriggers is defined
+
+#- debug: var=ctp_created_triggers
+
+
diff --git a/roles/lib_zabbix/tasks/create_user.yml b/roles/lib_zabbix/tasks/create_user.yml
new file mode 100644
index 000000000..1f752a9e1
--- /dev/null
+++ b/roles/lib_zabbix/tasks/create_user.yml
@@ -0,0 +1,11 @@
+---
+- name: Update zabbix credentialss for a user
+ zbx_user:
+ server: "{{ ozb_server }}"
+ user: "{{ ozb_user }}"
+ password: "{{ ozb_password }}"
+ alias: "{{ ozb_username }}"
+ passwd: "{{ ozb_new_password | default(ozb_password, true) }}"
+ register: user
+
+- debug: var=user.results