diff options
Diffstat (limited to 'playbooks/adhoc/zabbix_setup/clean_zabbix.yml')
-rw-r--r-- | playbooks/adhoc/zabbix_setup/clean_zabbix.yml | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/playbooks/adhoc/zabbix_setup/clean_zabbix.yml b/playbooks/adhoc/zabbix_setup/clean_zabbix.yml index bd71e6d1d..a31cbef65 100644 --- a/playbooks/adhoc/zabbix_setup/clean_zabbix.yml +++ b/playbooks/adhoc/zabbix_setup/clean_zabbix.yml @@ -2,65 +2,50 @@ - hosts: localhost gather_facts: no vars: - g_zserver: http://oso-rhel7-zabbix-web.kwoodsontest2.opstest.online.openshift.com/zabbix/api_jsonrpc.php + g_zserver: http://localhost/zabbix/api_jsonrpc.php g_zuser: Admin g_zpassword: zabbix roles: - - ../roles/os_zabbix + - ../../../roles/os_zabbix post_tasks: - - zbxapi: + - zbx_template: server: "{{ g_zserver }}" user: "{{ g_zuser }}" password: "{{ g_zpassword }}" - zbx_class: Template state: list - params: - output: extend - search: - host: 'Template Heartbeat' + name: 'Template Heartbeat' register: templ_heartbeat - - zbxapi: + - zbx_template: server: "{{ g_zserver }}" user: "{{ g_zuser }}" password: "{{ g_zpassword }}" - zbx_class: Template state: list - params: - output: extend - search: - host: 'Template App Zabbix Server' + name: 'Template App Zabbix Server' register: templ_zabbix_server - - zbxapi: + - zbx_template: server: "{{ g_zserver }}" user: "{{ g_zuser }}" password: "{{ g_zpassword }}" - zbx_class: Template state: list - params: - output: extend - search: - host: 'Template App Zabbix Agent' + name: 'Template App Zabbix Agent' register: templ_zabbix_agent - - zbxapi: + - zbx_template: server: "{{ g_zserver }}" user: "{{ g_zuser }}" password: "{{ g_zpassword }}" - zbx_class: Template state: list register: templates - debug: var=templ_heartbeat.results - - zbxapi: + - zbx_template: server: "{{ g_zserver }}" user: "{{ g_zuser }}" password: "{{ g_zpassword }}" - zbx_class: Template state: absent - params: "{{templates.results | difference(templ_zabbix_agent.results) | difference(templ_zabbix_server.results) | oo_collect('templateid') }}" - register: template_results + with_items: "{{ templates.results | difference(templ_zabbix_agent.results) | difference(templ_zabbix_server.results) | oo_collect('host') }}" when: templ_heartbeat.results | length == 0 |