Ansible/playbooks/zabbix_agent_install.yml
Tomislav Kopić 6e785d005d
Some checks failed
Lint ansible / lint (push) Failing after 13s
Fix formating
2024-02-22 23:05:08 +01:00

53 lines
1.2 KiB
YAML

---
- name: "Zabbix agent2 installation and setup"
hosts: Rack
become: yes
vars_files:
- ../vaults/zabbix.yml
vars:
- zabbix_version: 6.4
- zabbix_server: 192.168.1.161
- host_meta: OrangePiZero Rack
tasks:
- name: Upgrade zabbix-release
ansible.builtin.apt:
name: zabbix-release
state: latest
- name: uninstall zabbix agent
ansible.builtin.apt:
name: zabbix-agent
state: absent
- name: install zabbix agent2
ansible.builtin.apt:
name: zabbix-agent2
state: latest
- name: Configure zabbix agent service
ansible.builtin.template:
src: ../templates/zabbix_agentd2.j2
dest: /etc/zabbix/zabbix_agent2.conf
owner: zabbix
group: zabbix
mode: '0644'
backup: yes
- name: Copy zabbix key
ansible.builtin.copy:
content: "{{ psk_key }}"
dest: /etc/zabbix/key.psk
- name: Create a config directory
ansible.builtin.file:
path: /etc/zabbix/zabbix_agentd.conf.d/
state: directory
mode: '0755'
- name: Restart zabbix agent
ansible.builtin.service:
name: zabbix-agent2
state: restarted
enabled: yes