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
|
- name: Get config for not nas
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
zabbix_agent_cfg: "/etc/zabbix/zabbix_agent2.conf"
|
zabbix_agent_cfg: "/etc/zabbix/zabbix_agent2.conf"
|
||||||
@ -40,13 +42,12 @@
|
|||||||
delay: 5
|
delay: 5
|
||||||
when:
|
when:
|
||||||
- ansible_facts.architecture == "armv7l" or ansible_facts.architecture == "aarch64"
|
- ansible_facts.architecture == "armv7l" or ansible_facts.architecture == "aarch64"
|
||||||
|
register: command_result
|
||||||
ignore_errors: true
|
failed_when: "'FAILED' in command_result.stderr"
|
||||||
|
|
||||||
- name: Install a .deb package from the internet3
|
- name: Install a .deb package from the internet3
|
||||||
ansible.builtin.apt:
|
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
|
deb: https://repo.zabbix.com/zabbix/6.4/debian/pool/main/z/zabbix-release/zabbix-release_6.4-1+debian11_all.deb
|
||||||
|
|
||||||
when:
|
when:
|
||||||
- ansible_facts.architecture != "armv7l" and ansible_distribution == "Debian" and ansible_distribution_major_version == "11"
|
- 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/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
|
deb: https://repo.zabbix.com/zabbix/7.0/debian/pool/main/z/zabbix-release/zabbix-release_7.0-1+debian12_all.deb
|
||||||
when:
|
when:
|
||||||
- ansible_facts.architecture != "armv7l" and ansible_facts.architecture != "aarch64" and ansible_distribution == "Debian" and ansible_distribution_major_version == "12"
|
- ansible_facts.architecture != "armv7l"
|
||||||
ignore_errors: true
|
- 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
|
# - name: Install a .deb package localy
|
||||||
# ansible.builtin.apt:
|
# ansible.builtin.apt:
|
||||||
# deb: /tmp/zabbix-release_6.4-1+ubuntu22.04_all.deb
|
# deb: /tmp/zabbix-release_6.4-1+ubuntu22.04_all.deb
|
||||||
@ -68,8 +72,7 @@
|
|||||||
- zabbix-agent2-plugin-mongodb
|
- zabbix-agent2-plugin-mongodb
|
||||||
- zabbix-agent2-plugin-postgresql
|
- zabbix-agent2-plugin-postgresql
|
||||||
# - zabbix-agent2-plugin-mysql
|
# - zabbix-agent2-plugin-mysql
|
||||||
update_cache: yes
|
update_cache: true
|
||||||
ignore_errors: true
|
|
||||||
when: inventory_hostname != 'nas.home.lan'
|
when: inventory_hostname != 'nas.home.lan'
|
||||||
|
|
||||||
- name: Reconfigure zabbix agent Server
|
- name: Reconfigure zabbix agent Server
|
||||||
@ -139,8 +142,6 @@
|
|||||||
insertafter: '^# HostMetadata='
|
insertafter: '^# HostMetadata='
|
||||||
line: "HostMetadata=linux;jaydee"
|
line: "HostMetadata=linux;jaydee"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- name: Reconfigure zabbix-agent2 hostname
|
- name: Reconfigure zabbix-agent2 hostname
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: "{{ zabbix_agent_cfg }}"
|
path: "{{ zabbix_agent_cfg }}"
|
||||||
@ -149,13 +150,11 @@
|
|||||||
line: "HostMetadata=server;jaydee"
|
line: "HostMetadata=server;jaydee"
|
||||||
when: inventory_hostname == 'nas.home.lan' or inventory_hostname == 'm-server.home.lan'
|
when: inventory_hostname == 'nas.home.lan' or inventory_hostname == 'm-server.home.lan'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- name: Add the user 'to group video
|
- name: Add the user 'to group video
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
name: zabbix
|
name: zabbix
|
||||||
groups: video
|
groups: video
|
||||||
append: yes
|
append: true
|
||||||
when: inventory_hostname != 'nas.home.lan'
|
when: inventory_hostname != 'nas.home.lan'
|
||||||
|
|
||||||
|
|
||||||
@ -168,8 +167,6 @@
|
|||||||
|
|
||||||
|
|
||||||
- name: Restart agent
|
- 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'
|
when: inventory_hostname == 'nas.home.lan'
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"
|
|
||||||
|
Reference in New Issue
Block a user