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