From 58679a5fb8d0a57385cd54d158057a946f140400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Manuel=20Dom=C3=ADnguez?= Date: Wed, 28 Jun 2023 08:48:44 +0200 Subject: [PATCH 1/2] Revert "Fix role failing on Squid task "Create the cache directories for the first time"" This reverts commit f220483465d3f5e426e0937c739045cbb79be43c. --- tasks/squid.yml | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/tasks/squid.yml b/tasks/squid.yml index 15c9499..b994e61 100644 --- a/tasks/squid.yml +++ b/tasks/squid.yml @@ -6,7 +6,7 @@ backup: true mode: 0644 notify: - - Restart squid + - restart squid - name: Fix cache directory permission ansible.builtin.file: @@ -18,27 +18,13 @@ setype: squid_cache_t when: cvmfs_stratum1_cache_dir is defined -- name: Check whether the cache directories exist - ansible.builtin.stat: - path: "{{ cvmfs_stratum1_cache_dir.dir }}/00" - register: cvmfs_stratum1_cache_dir_stat - when: cvmfs_stratum1_cache_dir is defined - - name: Create the cache directories for the first time - when: cvmfs_stratum1_cache_dir is defined and not cvmfs_stratum1_cache_dir_stat.stat.exists - block: - - - name: Ensure squid is stopped - ansible.builtin.service: - name: "{{ cvmfs_squid_service_name }}" - state: stopped - - - name: Create the cache directories - become: true - become_user: "{{ cvmfs_squid_user }}" - ansible.builtin.command: squid -z - args: - creates: "{{ cvmfs_stratum1_cache_dir.dir }}/00" + become: true + become_user: "{{ cvmfs_squid_user }}" + ansible.builtin.command: squid -z + args: + creates: "{{ cvmfs_stratum1_cache_dir }}/00" + when: cvmfs_stratum1_cache_dir is defined - name: Ensure squid is enabled and started ansible.builtin.service: From 13fbd036ad1a11b1a0853abdd02142edb87d728b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Manuel=20Dom=C3=ADnguez?= Date: Wed, 28 Jun 2023 08:53:41 +0200 Subject: [PATCH 2/2] Fix role failing on Squid task "Create the cache directories for the first time" This is a simpler solution than that from f220483. In fact, the cause of the problem was just a typo (see changes and docs for ansible.builtin.command). --- tasks/squid.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/squid.yml b/tasks/squid.yml index b994e61..7930ecf 100644 --- a/tasks/squid.yml +++ b/tasks/squid.yml @@ -23,7 +23,7 @@ become_user: "{{ cvmfs_squid_user }}" ansible.builtin.command: squid -z args: - creates: "{{ cvmfs_stratum1_cache_dir }}/00" + creates: "{{ cvmfs_stratum1_cache_dir.dir }}/00" when: cvmfs_stratum1_cache_dir is defined - name: Ensure squid is enabled and started