feat: move stuff around part 3

This commit is contained in:
Simon Cornet 2025-10-03 10:38:46 +02:00
commit c0082d4bc3
12 changed files with 1 additions and 7 deletions

View file

@ -1,33 +0,0 @@
---
# setup psk
- name: "setup psk"
ansible.builtin.template:
src: "templates/zabbix/zabbix_agent.psk.j2"
dest: "/etc/zabbix/zabbix_agent.psk"
owner: "zabbix"
group: "zabbix"
mode: "0640"
notify: "restart zabbix-agent"
# config agent
- name: "config agent"
ansible.builtin.template:
src: "templates/zabbix/zabbix_agent.conf.j2"
dest: "/etc/zabbix/zabbix_agent2.conf"
owner: "root"
group: "root"
mode: "0664"
notify: "restart zabbix-agent"
# configure plugins
- name: "configure plugins"
ansible.builtin.copy:
src: "{{ item }}"
dest: "/etc/zabbix/zabbix_agent2.d/plugins.d/"
owner: "root"
group: "root"
mode: "0644"
with_fileglob:
- "files/zabbix/plugins.d/*"
notify: "restart zabbix-agent"

View file

@ -1,68 +0,0 @@
---
# install zabbix-agent2
- name: "install zabbix-agent2"
when: "zabbix_major_version not in zabbix_current_version.stdout"
block:
# install repository - debian
- name: "install repository"
when: 'ansible_os_family == "Debian"'
block:
# remove old agent
- name: "remove old agent"
ansible.builtin.apt:
name: "{{ item }}"
state: "absent"
loop:
- "zabbix-agent2"
- "zabbix-agent2-plugin-*"
# install agent
- name: "install agent"
ansible.builtin.apt:
name: "{{ item }}"
state: "present"
update_cache: true
when: 'ansible_os_family == "Debian"'
loop:
- "zabbix-agent2"
- "zabbix-agent2-plugin-*"
# install repository - suse
- name: "install repository"
when: 'ansible_os_family == "Suse"'
block:
# remove old agent
- name: "remove old agent"
ansible.builtin.zypper:
name: "{{ item }}"
state: "absent"
loop:
- "zabbix-agent2"
- "zabbix-agent2-plugin-*"
# install agent
- name: "install agent"
ansible.builtin.zypper:
name: "{{ item }}"
disable_recommends: false
state: "present"
when: 'ansible_os_family == "Suse"'
loop:
- "zabbix-agent2"
- "zabbix-agent2-plugin-*"
# install sudoers file
- name: "install sudoers file"
ansible.builtin.template:
src: "templates/sudoers.d/zabbix.j2"
dest: "/etc/sudoers.d/zabbix"
owner: "root"
group: "root"
mode: "0440"
when: "zabbix_user_sudo"

View file

@ -1,23 +0,0 @@
---
# load variables and collect version information
- name: "include vars and collect versions"
block:
# collect zabbix-agent2 version information
- name: "collect version information"
ansible.builtin.shell:
cmd: "zabbix_agent2 --version | head -n 1"
changed_when: false
failed_when: false
ignore_errors: true
register: "zabbix_current_version"
# zabbix-agent install
- name: "zabbix-agent install"
ansible.builtin.include_tasks: "install.yaml"
# zabbix-agent config
- name: "zabbix-agent config"
ansible.builtin.include_tasks: "config.yaml"