mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2026-03-12 21:32:48 +01:00
build
This commit is contained in:
@@ -14,14 +14,13 @@
|
||||
headers:
|
||||
Content-Type: "application/json"
|
||||
Authorization: "Bearer {{ zabbix_auth_token }}"
|
||||
register: proxygroup_check
|
||||
register: proxygroup_query
|
||||
run_once: true # Run this task only once
|
||||
|
||||
- name: Print proxy_check
|
||||
- name: Print proxygroup_query
|
||||
debug:
|
||||
msg: "{{ proxygroup_check }}"
|
||||
msg: "{{ proxygroup_query }}"
|
||||
run_once: true # Run this task only once
|
||||
when: proxygroup_check.json.result | length != 0
|
||||
|
||||
- name: Create proxy group if not exists
|
||||
uri:
|
||||
@@ -39,14 +38,24 @@
|
||||
headers:
|
||||
Content-Type: "application/json"
|
||||
Authorization: "Bearer {{ zabbix_auth_token }}"
|
||||
when: proxygroup_check.json.result | length == 0
|
||||
register: proxygroup_check
|
||||
when: proxygroup_query.json.result | length == 0
|
||||
register: proxygroup_create
|
||||
run_once: true # Run this task only once
|
||||
|
||||
- name: Print proxygroup_check
|
||||
- name: Print proxygroup_create
|
||||
debug:
|
||||
msg: "{{ proxygroup_check }}"
|
||||
msg: "{{ proxygroup_create }}"
|
||||
run_once: true # Run this task only once
|
||||
when: proxygroup_create.json.result | length != 0
|
||||
|
||||
- set_fact:
|
||||
proxygroup_id: >-
|
||||
{{
|
||||
proxygroup_create.json.result.proxy_groupid[0]
|
||||
if not proxygroup_create.skipped
|
||||
else proxygroup_query.json.result[0].proxy_groupid
|
||||
}}
|
||||
|
||||
|
||||
|
||||
- name: Check if proxy exists
|
||||
@@ -82,7 +91,7 @@
|
||||
method: "proxy.create"
|
||||
params:
|
||||
name: "{{ inventory_hostname }}"
|
||||
proxy_groupid: "{{ proxygroup_check.json.result[0].proxy_groupid }}"
|
||||
proxy_groupid: "{{ proxygroup_id }}"
|
||||
operating_mode: 0
|
||||
local_address: "{{ ansible_default_ipv4.address }}"
|
||||
port: "10051"
|
||||
|
||||
Reference in New Issue
Block a user