| Server IP : 85.214.239.14 / Your IP : 216.73.216.178 Web Server : Apache/2.4.65 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 8.2.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/ansible_collections/community/zabbix/roles/zabbix_agent/tasks/ |
Upload File : |
---
# tasks file for zabbix_agent
- name: "Set variables specific for Zabbix Agent 2"
set_fact:
zabbix_agent_service: zabbix-agent2
zabbix_agent_package: zabbix-agent2
when:
- zabbix_agent2 is defined
- zabbix_agent2
tags:
- always
- name: "Fix facts for linuxmint - distribution release"
set_fact:
zabbix_agent_distribution_release: xenial
when:
- ansible_os_family == "Linuxmint"
- ansible_distribution_release == "sonya" or ansible_distribution_release == "serena"
tags:
- always
- name: "Fix facts for linuxmint - family"
set_fact:
zabbix_agent_os_family: Debian
when:
- ansible_os_family == "Linuxmint"
tags:
- always
- name: "Fix facts for XCP-ng - family"
set_fact:
zabbix_agent_os_family: RedHat
when:
- ansible_os_family == "XCP-ng"
- name: "Include OS-specific variables"
include_vars: "{{ zabbix_agent_os_family }}.yml"
tags:
- always
- name: Determine Latest Supported Zabbix Version
set_fact:
zabbix_agent_version: "{{ zabbix_valid_agent_versions[ansible_distribution_major_version][0] | default(6.0) }}"
when: zabbix_agent_version is not defined
- name: "Reset zabbix_agent_version for Ubuntu 22.04 to 6.0"
# README https://support.zabbix.com/browse/ZBXNEXT-7624
set_fact:
zabbix_version: 6.0
zabbix_agent_version: 6.0
when:
- ansible_distribution_release is defined
- ansible_distribution_release == "jammy"
- ( zabbix_agent_version is version ('6.0','lt') or
zabbix_version is version ('6.0','lt') )
- name: "Install the correct repository"
include_tasks: "{{ zabbix_agent_os_family if (zabbix_agent_os_family not in ['Sangoma']) else 'RedHat' }}.yml"
when:
- not (zabbix_agent_docker | bool)
tags:
- always
- name: "Set the 'ansible_python_interpreter' to the one we use for running this playbook."
set_fact:
ansible_python_interpreter: "{{ ansible_playbook_python }}"
delegate_to: localhost
delegate_facts: true
when:
- (zabbix_install_pip_packages | bool) or (zabbix_api_create_hostgroup | bool) or (zabbix_api_create_hosts | bool)
- name: "Install local python-netaddr package"
pip:
name: netaddr
state: present
register: zabbix_python_netaddr_package_installed
until: zabbix_python_netaddr_package_installed is succeeded
delegate_to: localhost
run_once: true
become: "{{ zabbix_agent_become_on_localhost }}"
when:
- zabbix_install_pip_packages | bool
- ansible_all_ipv4_addresses is defined or (zabbix_agent_ip is not defined and total_private_ip_addresses is defined)
- name: "Encrypt with TLS PSK auto management"
include_tasks: tlspsk_auto.yml
when:
- not zabbix_agent2
- zabbix_agent_tlspsk_auto | bool
- (zabbix_agent_tlspskfile is undefined) or (zabbix_agent_tlspskfile | length == '0')
- (zabbix_agent_tlspsk_secret is undefined) or (zabbix_agent_tlspsk_secret | length == '0')
- name: "Encrypt with TLS PSK auto management"
include_tasks: tlspsk_auto_agent2.yml
when:
- zabbix_agent2 | bool
- zabbix_agent2_tlspsk_auto | bool
- (zabbix_agent2_tlspskfile is undefined) or (zabbix_agent2_tlspskfile | length == '0')
- (zabbix_agent2_tlspsk_secret is undefined) or (zabbix_agent2_tlspsk_secret | length == '0')
- name: "Configure Agent"
include_tasks: Windows_conf.yml
when:
- zabbix_agent_os_family == "Windows"
tags:
- always
- name: "Configure Agent"
include_tasks: Darwin.yml
when:
- zabbix_agent_os_family == "Darwin"
tags:
- always
- name: "Configure Agent"
include_tasks: Linux.yml
when:
- (zabbix_agent_os_family != "Windows" and zabbix_agent_os_family != "Darwin") or (zabbix_agent_docker | bool)
tags:
- always
- name: "Run the API calls to Zabbix Server"
vars:
gather_facts: false
ansible_user: "{{ zabbix_api_login_user }}"
ansible_network_os: community.zabbix.zabbix
ansible_connection: httpapi
# Can't think of a way to make http_login_* vars be undefined -(
http_login_user: "{{ zabbix_api_http_user | default(zabbix_http_user | default(-42)) }}"
http_login_password: "{{ zabbix_api_http_password | default(zabbix_http_password | default(-42)) }}"
include_tasks: api.yml
when:
- (zabbix_api_create_hostgroup | bool) or (zabbix_api_create_hosts | bool)
tags:
- api
- name: "Including userparameters"
include_tasks: "userparameter.yml"
when: zabbix_agent_userparameters|length > 0
tags:
- zabbix-agent
- userparameter