From e40b829103db88072c0e5fc759bff239cb214a43 Mon Sep 17 00:00:00 2001
From: Thomas Wiest <twiest@redhat.com>
Date: Wed, 30 Sep 2015 15:22:36 -0400
Subject: added Template Ops Tools

---
 roles/lib_zabbix/tasks/create_template.yml | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

(limited to 'roles/lib_zabbix/tasks')

diff --git a/roles/lib_zabbix/tasks/create_template.yml b/roles/lib_zabbix/tasks/create_template.yml
index 62259b680..41381e76c 100644
--- a/roles/lib_zabbix/tasks/create_template.yml
+++ b/roles/lib_zabbix/tasks/create_template.yml
@@ -9,7 +9,8 @@
 
 
 - set_fact:
-    lzbx_applications: "{{ template.zitems | oo_select_keys_from_list(['applications']) | oo_flatten | unique }}"
+    lzbx_item_applications: "{{ template.zitems | default([], True) | oo_select_keys_from_list(['applications']) | oo_flatten | unique }}"
+    lzbx_itemprototype_applications: "{{ template.zitemprototypes | default([], True) | oo_select_keys_from_list(['applications']) | oo_flatten | unique }}"
 
 - name: Create Application
   zbx_application:
@@ -18,9 +19,11 @@
     zbx_password: "{{ password }}"
     name: "{{ item }}"
     template_name: "{{ template.name }}"
-  with_items: lzbx_applications
+  with_items:
+  - "{{ lzbx_item_applications }}"
+  - "{{ lzbx_itemprototype_applications }}"
   register: created_application
-  when: template.zitems is defined
+  when: template.zitems is defined or template.zitemprototypes is defined
 
 - name: Create Items
   zbx_item:
-- 
cgit v1.2.3