summaryrefslogtreecommitdiffstats
path: root/roles/lib_zabbix/tasks
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2015-08-27 14:46:47 -0400
committerKenny Woodson <kwoodson@redhat.com>2015-08-27 14:46:47 -0400
commit2483b7767d4e56e41e9890adfffe4bdc1480a11b (patch)
tree172b9391942022f73c1884219a5813269119f701 /roles/lib_zabbix/tasks
parent96d9a943628578979b9cd0cb602bb04947c85466 (diff)
parent693be4802c2b3886b82681c5c1666b9f13d9ca36 (diff)
downloadopenshift-2483b7767d4e56e41e9890adfffe4bdc1480a11b.tar.gz
openshift-2483b7767d4e56e41e9890adfffe4bdc1480a11b.tar.bz2
openshift-2483b7767d4e56e41e9890adfffe4bdc1480a11b.tar.xz
openshift-2483b7767d4e56e41e9890adfffe4bdc1480a11b.zip
Merge pull request #520 from kwoodson/zbxupdates
Updating zabbix ansible 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