ansible/MY/base_util.yml
2026-05-22 06:43:27 +04:00

54 lines
1.8 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
- hosts: hip
gather_facts: yes # ВАЖНО: собираем факты о системе
become: yes
tasks:
- name: Install base utils
apt: name=mc,atop,htop,iotop,mtr-tiny,iperf,iperf3,dnsutils,tcpdump,iftop,byobu,git,nload,bmon state=latest update_cache=yes
# 1. Добавление репозитория Zabbix
- name: Добавление репозитория Zabbix
shell: |
wget https://repo.zabbix.com/zabbix/7.0/debian/pool/main/z/zabbix-release/zabbix-release_7.0-1+debian{{ ansible_distribution_major_version }}_all.deb
dpkg -i zabbix-release_7.0-1+debian{{ ansible_distribution_major_version }}_all.deb
apt update
args:
warn: no
when: ansible_distribution == "Debian"
- name: Добавление репозитория Zabbix для Ubuntu
shell: |
wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.0-1+ubuntu{{ ansible_distribution_major_version }}_all.deb
dpkg -i zabbix-release_7.0-1+ubuntu{{ ansible_distribution_major_version }}_all.deb
apt update
args:
warn: no
when: ansible_distribution == "Ubuntu"
# 2. Установка Zabbix Agent 2
- name: Установка Zabbix Agent 2
apt:
name: zabbix-agent2
state: present
update_cache: yes
# 3. Настройка конфигурации (добавление сети 11.200.0.0/24)
- name: Добавление доверенной сети в конфиг
lineinfile:
path: /etc/zabbix/zabbix_agent2.conf
regexp: "^Server="
line: "Server=127.0.0.1,11.200.0.0/24"
# 4. Запуск сервиса
- name: Запуск Zabbix Agent 2
systemd:
name: zabbix-agent2
state: restarted
enabled: yes