mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2025-12-14 10:04:52 +01:00
build
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
- name: Install zabbix agent
|
||||
become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"
|
||||
block:
|
||||
- name: Include facts
|
||||
ansible.builtin.include_role:
|
||||
name: "setup"
|
||||
when: ansible_facts.architecture is not defined
|
||||
|
||||
- name: Get config for not nas
|
||||
ansible.builtin.set_fact:
|
||||
zabbix_agent_cfg: "/etc/zabbix/zabbix_agent2.conf"
|
||||
@@ -55,6 +60,17 @@
|
||||
ansible.builtin.apt:
|
||||
# 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.4/release/debian/pool/main/z/zabbix-release/zabbix-release_latest_7.4+debian12_all.deb
|
||||
when:
|
||||
- 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 from the Debian 13
|
||||
ansible.builtin.apt:
|
||||
# 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.4/release/debian/pool/main/z/zabbix-release/zabbix-release_latest_7.4+debian13_all.deb
|
||||
when:
|
||||
- ansible_facts.architecture != "armv7l"
|
||||
- ansible_facts.architecture != "aarch64"
|
||||
@@ -83,7 +99,7 @@
|
||||
- zabbix-agent2-plugin-postgresql
|
||||
# - zabbix-agent2-plugin-mysql
|
||||
only_upgrade: true
|
||||
state: latest
|
||||
state: present
|
||||
when: inventory_hostname != 'nas.home.lan'
|
||||
|
||||
- name: Reconfigure zabbix agent Server
|
||||
@@ -173,9 +189,40 @@
|
||||
regexp: "^HostMetadata=.*"
|
||||
insertafter: '^# HostMetadata='
|
||||
line: "HostMetadata=server;jaydee"
|
||||
when: inventory_hostname == 'nas.home.lan' or inventory_hostname == 'm-server.home.lan'
|
||||
when: inventory_hostname == 'm-server.home.lan'
|
||||
|
||||
- name: Add the user 'to group video
|
||||
- name: Create docker-swarm plugin directory
|
||||
ansible.builtin.file:
|
||||
path: /usr/lib/zabbix/plugins/docker-swarm/
|
||||
state: directory
|
||||
mode: '0755'
|
||||
owner: zabbix
|
||||
group: zabbix
|
||||
|
||||
- name: Copy docker-swarm plugin
|
||||
ansible.builtin.copy:
|
||||
src: docker-swarm-linux-amd64
|
||||
dest: /usr/lib/zabbix/plugins/docker-swarm/docker-swarm-linux-x86_64
|
||||
mode: '0755'
|
||||
owner: zabbix
|
||||
group: zabbix
|
||||
when: inventory_hostname == 'm-server.home.lan'
|
||||
|
||||
- name: Reconfigure zabbix-agent2 hostname
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ zabbix_agent_cfg }}"
|
||||
regexp: "^Plugins.DockerSwarm.System.Path=.*"
|
||||
insertafter: '^# HostMetadata='
|
||||
line: "Plugins.DockerSwarm.System.Path=/usr/lib/zabbix/plugins/docker-swarm/docker-swarm-linux-x86_64"
|
||||
when: inventory_hostname == 'm-server.home.lan'
|
||||
- name: Reconfigure zabbix-agent2 hostname
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ zabbix_agent_cfg }}"
|
||||
regexp: "^Plugins.DockerSwarm.System.Timeout=.*"
|
||||
line: "Plugins.DockerSwarm.System.Timeout=30"
|
||||
when: inventory_hostname == 'm-server.home.lan'
|
||||
|
||||
- name: Add the user 'zabbix' to group video
|
||||
ansible.builtin.user:
|
||||
name: zabbix
|
||||
groups: video
|
||||
|
||||
Reference in New Issue
Block a user