From ba1c4931b555ddc692ababdc21f20612d4da5b0f Mon Sep 17 00:00:00 2001 From: Alexander Pykavy Date: Thu, 8 Aug 2024 08:11:53 +0200 Subject: [PATCH] Fix zabbix_agent include_dir creation logic As a string is iterable of chars, the previous logic changed the permissions for all single-character dirs: '/', 'e', 't', 'c', '/', etc. --- roles/zabbix_agent/tasks/Linux.yml | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/roles/zabbix_agent/tasks/Linux.yml b/roles/zabbix_agent/tasks/Linux.yml index 9aeb3c236..99af1374b 100644 --- a/roles/zabbix_agent/tasks/Linux.yml +++ b/roles/zabbix_agent/tasks/Linux.yml @@ -128,18 +128,6 @@ tags: - config -- name: "Create include dir zabbix-agent" - ansible.builtin.file: - path: "{{ zabbix_agent_include_dir }}" - owner: root - group: zabbix - mode: "{{ zabbix_agent_include_mode }}" - state: directory - become: true - tags: - - config - when: zabbix_agent_include_dir is string - - name: "Create include dirs zabbix-agent" ansible.builtin.file: path: "{{ include_dir }}" @@ -147,10 +135,9 @@ group: zabbix mode: "{{ zabbix_agent_include_mode }}" state: directory - loop: "{{ zabbix_agent_include_dir | list }}" # To prevent errors, filter a string value as a list + loop: "{{ [zabbix_agent_include_dir] if zabbix_agent_include_dir is string else zabbix_agent_include_dir }}" loop_control: loop_var: 'include_dir' - when: zabbix_agent_include_dir is iterable become: true tags: - config