zabbix: add tags to zabbix_agent tasks

Signed-off-by: David Kirwan <davidkirwanirl@gmail.com>
This commit is contained in:
David Kirwan 2024-02-14 12:50:01 +00:00
parent 856afa8818
commit c7bf77dccc
No known key found for this signature in database
GPG key ID: A5893AB6474AC37D

View file

@ -4,19 +4,23 @@
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml" - "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
- "{{ ansible_distribution }}.yml" - "{{ ansible_distribution }}.yml"
- common.yml - common.yml
tags:
- zabbix_agent
- name: Installing Zabbix packages - name: Installing Zabbix packages
yum: yum:
name: "{{ zabbix_pkgs_list }}" name: "{{ zabbix_pkgs_list }}"
state: latest state: latest
register: pkg_install register: pkg_install
tags:
- zabbix_agent
- name: Installing selinux dependency packages - name: Installing selinux dependency packages
yum: yum:
name: "{{ pkgs_list }}" name: "{{ pkgs_list }}"
state: installed state: installed
tags: tags:
- packages - zabbix_agent
- name: Distributing custom selinux policies - name: Distributing custom selinux policies
copy: copy:
@ -26,10 +30,14 @@
with_items: with_items:
- centos-zabbix-agent.pp - centos-zabbix-agent.pp
when: ansible_distribution == "Centos" when: ansible_distribution == "Centos"
tags:
- zabbix_agent
- name: reload custom selinux files - name: reload custom selinux files
shell: /usr/sbin/semodule -u "/etc/selinux/centos/centos-zabbix-agent.pp" shell: /usr/sbin/semodule -u "/etc/selinux/centos/centos-zabbix-agent.pp"
when: ansible_distribution == "Centos" and ansible_selinux.status == "enabled" and sepolicy.changed when: ansible_distribution == "Centos" and ansible_selinux.status == "enabled" and sepolicy.changed
tags:
- zabbix_agent
- name: Allowing zabbix to connect to network resources - name: Allowing zabbix to connect to network resources
seboolean: seboolean:
@ -37,17 +45,23 @@
persistent: yes persistent: yes
state: yes state: yes
when: ansible_selinux.status == "enabled" when: ansible_selinux.status == "enabled"
tags:
- zabbix_agent
- name: Ensures config directory - name: Ensures config directory
file: file:
path: "{{ zabbix_agentd_dir }}" path: "{{ zabbix_agentd_dir }}"
state: directory state: directory
tags:
- zabbix_agent
- name: Configuring Zabbix agentd - name: Configuring Zabbix agentd
template: template:
src: zabbix_agentd.conf.j2 src: zabbix_agentd.conf.j2
dest: "{{ zabbix_agentd }}" dest: "{{ zabbix_agentd }}"
notify: restart_zabbix_agent notify: restart_zabbix_agent
tags:
- zabbix_agent
- name: Copy zabbix-agend.conf psk config - name: Copy zabbix-agend.conf psk config
copy: copy:
@ -58,6 +72,8 @@
mode: 0600 mode: 0600
with_fileglob: with_fileglob:
- "{{ private }}/files/zabbix/fedora{{env_suffix}}.psk" - "{{ private }}/files/zabbix/fedora{{env_suffix}}.psk"
tags:
- zabbix_agent
- name: Ensuring we have a directory to put zabbix scripts - name: Ensuring we have a directory to put zabbix scripts
file: file:
@ -66,6 +82,8 @@
mode: 0770 mode: 0770
owner: zabbix owner: zabbix
group: zabbix group: zabbix
tags:
- zabbix_agent
- name: Set ownership on /var/run/zabbix/ - name: Set ownership on /var/run/zabbix/
ansible.builtin.file: ansible.builtin.file:
@ -75,6 +93,8 @@
mode: 0770 mode: 0770
owner: zabbix owner: zabbix
group: zabbix group: zabbix
tags:
- zabbix_agent
- name: Ensuring we have a directory to put zabbix logs - name: Ensuring we have a directory to put zabbix logs
file: file:
@ -83,6 +103,8 @@
mode: 0770 mode: 0770
owner: zabbix owner: zabbix
group: zabbix group: zabbix
tags:
- zabbix_agent
- name: Adding some other conf files under zabbix_agentd.d - name: Adding some other conf files under zabbix_agentd.d
template: template:
@ -93,6 +115,8 @@
notify: restart_zabbix_agent notify: restart_zabbix_agent
with_items: with_items:
- interface-alias.conf - interface-alias.conf
tags:
- zabbix_agent
- name: Enabling Zabbix service - name: Enabling Zabbix service
service: service:
@ -101,5 +125,7 @@
enabled: yes enabled: yes
with_items: with_items:
- zabbix-agent - zabbix-agent
tags:
- zabbix_agent
- include_tasks: tools.yml - include_tasks: tools.yml