From 9c4b59c9a12d03a92a6fd1938f18d59fae5a91a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=85=D0=BC=D0=B5=D1=82=D0=B7=D1=8F=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=A0=D1=83=D1=81=D1=82=D0=B0=D0=BC=20=D0=A0=D0=B0?= =?UTF-8?q?=D0=BC=D0=B8=D0=BB=D0=B5=D0=B2=D0=B8=D1=87?= Date: Thu, 28 May 2026 17:02:09 +0400 Subject: [PATCH] + zbx --- MY/hosts.yaml | 4 ++-- MY/install_zabbix-agent.yaml | 39 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 MY/install_zabbix-agent.yaml diff --git a/MY/hosts.yaml b/MY/hosts.yaml index 7026c6d..4c8a1da 100644 --- a/MY/hosts.yaml +++ b/MY/hosts.yaml @@ -11,8 +11,8 @@ all_servers: docker_overlay_net_iprange: 11.100.0.128/25 hip: hosts: - #france# 83.171.226.120 - 93.177.116.129: + 83.171.226.120: #france + #93.177.116.129: #niderlands ansible_port: 35130 vars: ansible_user: pycm1k diff --git a/MY/install_zabbix-agent.yaml b/MY/install_zabbix-agent.yaml new file mode 100644 index 0000000..79f7a77 --- /dev/null +++ b/MY/install_zabbix-agent.yaml @@ -0,0 +1,39 @@ +--- +- name: Установка Zabbix Agent 2 + hosts: hip + become: yes + gather_facts: yes + vars: + zabbix_server_host: "zabbix.example.com" + + tasks: + - name: Добавление репозитория Zabbix (Debian/Ubuntu) + shell: | + apt-get update + apt-get install -y wget + wget -O zabbix-release.deb https://repo.zabbix.com/zabbix/7.0/debian/pool/main/z/zabbix-release/zabbix-release_7.0-1+debian12_all.deb + dpkg -i zabbix-release.deb + apt-get update + args: + warn: no + + - name: Установка Zabbix Agent 2 + apt: + name: zabbix-agent2 + state: present + + - name: Настройка Zabbix Agent 2 + lineinfile: + path: /etc/zabbix/zabbix_agent2.conf + regexp: "^{{ item.param }}=" + line: "{{ item.param }}={{ item.value }}" + loop: + - { param: "Server", value: "{{ zabbix_server_host }},11.200.0.0/24,88.80.32.24" } + - { param: "ServerActive", value: "{{ zabbix_server_host }}" } + - { param: "Hostname", value: "{{ inventory_hostname }}" } + + - name: Запуск сервиса + systemd: + name: zabbix-agent2 + state: restarted + enabled: yes