Migrated from legacy playbook repo into Ansible collection format: Roles (171 total): - common: 44 roles (fact gathering, SSH setup, utilities) - configuration: 32 roles (system config, networking, satellite) - provisioning: 16 roles (VMware, Azure, physical server deployment) - security: 15 roles (OpenSCAP hardening, certificates, AD integration) - monitoring: 12 roles (Zabbix, logging agents, metrics) - networking: 12 roles (DNS, DHCP, network interfaces) - satellite: 4 roles (Pulp/Satellite management) - misc: 36 roles (various utilities) Playbooks (159 total): - provisioning: 14 playbooks - azure: 13 playbooks - configuration: 22 playbooks - maintenance: 10 playbooks - security: 10 playbooks - monitoring: 9 playbooks - vcenter: 6 playbooks - networking: 7 playbooks - misc: 65 playbooks
65 lines
2.7 KiB
YAML
65 lines
2.7 KiB
YAML
---
|
|
- name: "Setting Zabbix Proxy on hosts"
|
|
hosts: all
|
|
gather_facts: true
|
|
become: yes
|
|
become_user: root
|
|
vars_prompt:
|
|
- name: zabbix_group
|
|
prompt: What is the name of the two zabbix servers you want in the zabbix agent config. Example zbx-proxy-01.EXAMPLE-CORP.COM,zbx-proxy-02.EXAMPLE-CORP.COM
|
|
private: false
|
|
- name: zabbix_group_port
|
|
prompt: What is the name of the two zabbix servers you want in the zabbix agent config with ports. Example zbx-proxy-01.EXAMPLE-CORP.COM:10051,zbx-proxy-02.EXAMPLE-CORP.COM:10051
|
|
private: false
|
|
tasks:
|
|
- name: "Gather service facts"
|
|
ansible.builtin.service_facts:
|
|
|
|
- name: "Configure Zabbix Proxy for zabbix-agent2"
|
|
when: "'zabbix-agent2.service' in ansible_facts.services and ansible_facts.services['zabbix-agent2.service'].state == 'running'"
|
|
lineinfile:
|
|
path: "/etc/zabbix/zabbix_agent2.d/agent.conf"
|
|
search_string: "{{ item }}"
|
|
line: "{{ item }}{{ zabbix_group }}"
|
|
with_items:
|
|
- "Server="
|
|
|
|
- name: "Configure Zabbix Proxy for zabbix-agent2 number 2"
|
|
when: "'zabbix-agent2.service' in ansible_facts.services and ansible_facts.services['zabbix-agent2.service'].state == 'running'"
|
|
lineinfile:
|
|
path: "/etc/zabbix/zabbix_agent2.d/agent.conf"
|
|
search_string: "{{ item }}"
|
|
line: "{{ item }}{{ zabbix_group_port }}"
|
|
with_items:
|
|
- "ServerActive="
|
|
|
|
- name: "Restart Zabbix Agent2"
|
|
when: "'zabbix-agent2.service' in ansible_facts.services and ansible_facts.services['zabbix-agent2.service'].state == 'running'"
|
|
ansible.builtin.systemd:
|
|
name: zabbix-agent2.service
|
|
state: restarted
|
|
|
|
- name: "Configure Zabbix Proxy for zabbix-agent"
|
|
when: "'zabbix-agent.service' in ansible_facts.services and ansible_facts.services['zabbix-agent.service'].state == 'running'"
|
|
lineinfile:
|
|
path: "/etc/zabbix/zabbix_agentd.d/agent.conf"
|
|
search_string: "{{ item }}"
|
|
line: "{{ item }}{{ zabbix_group }}"
|
|
with_items:
|
|
- "Server="
|
|
|
|
- name: "Configure Zabbix Proxy for zabbix-agent number 2"
|
|
when: "'zabbix-agent.service' in ansible_facts.services and ansible_facts.services['zabbix-agent.service'].state == 'running'"
|
|
lineinfile:
|
|
path: "/etc/zabbix/zabbix_agentd.d/agent.conf"
|
|
search_string: "{{ item }}"
|
|
line: "{{ item }}{{ zabbix_group_port }}"
|
|
with_items:
|
|
- "ServerActive="
|
|
|
|
- name: "Restart Zabbix Agent"
|
|
when: "'zabbix-agent.service' in ansible_facts.services and ansible_facts.services['zabbix-agent.service'].state == 'running'"
|
|
ansible.builtin.systemd:
|
|
name: zabbix-agent.service
|
|
state: restarted
|