From 018638b6aa2d961cc873b244015d7e6aa455dad4 Mon Sep 17 00:00:00 2001
From: Troy W <pyrodie18@gmail.com>
Date: Sat, 6 Jul 2024 13:20:15 -0400
Subject: [PATCH] Fixing zabbix agent include issues (#1323)

---
 changelogs/fragments/1322.yml              | 2 ++
 roles/zabbix_agent/defaults/main.yml       | 2 +-
 roles/zabbix_agent/tasks/remove.yml        | 2 +-
 roles/zabbix_agent/tasks/userparameter.yml | 2 +-
 4 files changed, 5 insertions(+), 3 deletions(-)
 create mode 100644 changelogs/fragments/1322.yml

diff --git a/changelogs/fragments/1322.yml b/changelogs/fragments/1322.yml
new file mode 100644
index 000000000..a63050c35
--- /dev/null
+++ b/changelogs/fragments/1322.yml
@@ -0,0 +1,2 @@
+bugfixes:
+  - zabbix_agent Role - Fixed several issues related to `zabbix_agent_include_dir` and `zabbix_agent_include`
diff --git a/roles/zabbix_agent/defaults/main.yml b/roles/zabbix_agent/defaults/main.yml
index 7d60a8281..448f7cd16 100644
--- a/roles/zabbix_agent/defaults/main.yml
+++ b/roles/zabbix_agent/defaults/main.yml
@@ -136,7 +136,7 @@ zabbix_agent_docker_ports:
 zabbix_agent_docker_security_opts:
   - apparmor:unconfined
 zabbix_agent_docker_volumes:
-  - /etc/zabbix/zabbix_agentd.d:{{ zabbix_agent_include }}
+  - /etc/zabbix/zabbix_agentd.d:{{ zabbix_agent_include_dir }}
   - /:/hostfs:ro
   - /etc:/hostfs/etc:ro
   - /proc:/hostfs/proc:ro
diff --git a/roles/zabbix_agent/tasks/remove.yml b/roles/zabbix_agent/tasks/remove.yml
index f7822a513..65add4f70 100644
--- a/roles/zabbix_agent/tasks/remove.yml
+++ b/roles/zabbix_agent/tasks/remove.yml
@@ -20,6 +20,6 @@
 
 - name: "Remove | Remove the agent-include-dir"
   ansible.builtin.file:
-    path: "{{ zabbix_agent_include | replace('agent2', 'agent') }}"
+    path: "{{ zabbix_agent_include_dir | replace('agent2', 'agent') }}"
     state: absent
   become: true
diff --git a/roles/zabbix_agent/tasks/userparameter.yml b/roles/zabbix_agent/tasks/userparameter.yml
index ec163cb11..4ea255f83 100644
--- a/roles/zabbix_agent/tasks/userparameter.yml
+++ b/roles/zabbix_agent/tasks/userparameter.yml
@@ -29,7 +29,7 @@
         - name: Install user-defined userparameters
           ansible.builtin.template:
             src: "{{ zabbix_agent_userparameters_templates_src }}/{{ item.name }}.j2"
-            dest: "{{ zabbix_agent_include }}/userparameter_{{ item.name }}.conf"
+            dest: "{{ zabbix_agent_include_dir }}/userparameter_{{ item.name }}.conf"
             owner: zabbix
             group: zabbix
             mode: "0644"