mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2025-07-01 15:38:33 +02:00
klal
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
- block:
|
||||
- name: Install zabbix agent
|
||||
become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"
|
||||
block:
|
||||
- name: Get config for not nas
|
||||
ansible.builtin.set_fact:
|
||||
zabbix_agent_cfg: "/etc/zabbix/zabbix_agent2.conf"
|
||||
@ -40,13 +42,12 @@
|
||||
delay: 5
|
||||
when:
|
||||
- ansible_facts.architecture == "armv7l" or ansible_facts.architecture == "aarch64"
|
||||
|
||||
ignore_errors: true
|
||||
register: command_result
|
||||
failed_when: "'FAILED' in command_result.stderr"
|
||||
|
||||
- name: Install a .deb package from the internet3
|
||||
ansible.builtin.apt:
|
||||
deb: https://repo.zabbix.com/zabbix/6.4/debian/pool/main/z/zabbix-release/zabbix-release_6.4-1+debian11_all.deb
|
||||
|
||||
when:
|
||||
- ansible_facts.architecture != "armv7l" and ansible_distribution == "Debian" and ansible_distribution_major_version == "11"
|
||||
|
||||
@ -55,9 +56,12 @@
|
||||
# deb: https://repo.zabbix.com/zabbix/6.4/debian/pool/main/z/zabbix-release/zabbix-release_6.4-1+debian12_all.deb
|
||||
deb: https://repo.zabbix.com/zabbix/7.0/debian/pool/main/z/zabbix-release/zabbix-release_7.0-1+debian12_all.deb
|
||||
when:
|
||||
- ansible_facts.architecture != "armv7l" and ansible_facts.architecture != "aarch64" and ansible_distribution == "Debian" and ansible_distribution_major_version == "12"
|
||||
ignore_errors: true
|
||||
|
||||
- ansible_facts.architecture != "armv7l"
|
||||
- ansible_facts.architecture != "aarch64"
|
||||
- ansible_distribution == "Debian"
|
||||
- ansible_distribution_major_version == "12"
|
||||
register: command_result
|
||||
failed_when: "'FAILED' in command_result.stderr"
|
||||
# - name: Install a .deb package localy
|
||||
# ansible.builtin.apt:
|
||||
# deb: /tmp/zabbix-release_6.4-1+ubuntu22.04_all.deb
|
||||
@ -68,8 +72,7 @@
|
||||
- zabbix-agent2-plugin-mongodb
|
||||
- zabbix-agent2-plugin-postgresql
|
||||
# - zabbix-agent2-plugin-mysql
|
||||
update_cache: yes
|
||||
ignore_errors: true
|
||||
update_cache: true
|
||||
when: inventory_hostname != 'nas.home.lan'
|
||||
|
||||
- name: Reconfigure zabbix agent Server
|
||||
@ -139,8 +142,6 @@
|
||||
insertafter: '^# HostMetadata='
|
||||
line: "HostMetadata=linux;jaydee"
|
||||
|
||||
|
||||
|
||||
- name: Reconfigure zabbix-agent2 hostname
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ zabbix_agent_cfg }}"
|
||||
@ -149,13 +150,11 @@
|
||||
line: "HostMetadata=server;jaydee"
|
||||
when: inventory_hostname == 'nas.home.lan' or inventory_hostname == 'm-server.home.lan'
|
||||
|
||||
|
||||
|
||||
- name: Add the user 'to group video
|
||||
ansible.builtin.user:
|
||||
name: zabbix
|
||||
groups: video
|
||||
append: yes
|
||||
append: true
|
||||
when: inventory_hostname != 'nas.home.lan'
|
||||
|
||||
|
||||
@ -168,8 +167,6 @@
|
||||
|
||||
|
||||
- name: Restart agent
|
||||
ansible.builtin.shell: /etc/init.d/ZabbixAgent.sh restart
|
||||
ansible.builtin.command: /etc/init.d/ZabbixAgent.sh restart
|
||||
when: inventory_hostname == 'nas.home.lan'
|
||||
|
||||
|
||||
become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"
|
||||
changed_when: false
|
||||
|
Reference in New Issue
Block a user