From b6b158c9662eeafbb5bb9850cc98d5d0372a1919 Mon Sep 17 00:00:00 2001 From: Adam Zimmermann Date: Thu, 16 Jan 2020 15:46:22 -0600 Subject: [PATCH 1/5] Ajust files directory sub-folder permissions after site install. --- tasks/main.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index e38019f..5726c0d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -8,7 +8,7 @@ mode: 0770 become: "{{ deploydrupal_files_become }}" -- name: open permissions on default directory. +- name: open permissions on site directory. file: path: "{{ deploydrupal_core_path }}/sites/{{ deploydrupal_site_name }}" state: directory @@ -98,6 +98,17 @@ when: - deploydrupal_site_install +- name: adjust files directory sub-folder permissions after site install. + file: + path: "{{ deploydrupal_core_path }}/sites/{{ deploydrupal_site_name }}/files" + state: directory + owner: "{{ deploydrupal_apache_user }}" + group: "{{ deploydrupal_checkout_user }}" + mode: 0770 + recurse: yes + become: "{{ deploydrupal_files_become }}" + when: deploydrupal_site_install_config + # Import the latest configuration. This includes the latest # configuration_split configuration. Importing this twice ensures that the # latter command enables and disables modules based upon the most up to date From 68454a7ae523aebf48b632bd1efd3169fcbc90f9 Mon Sep 17 00:00:00 2001 From: Adam Zimmermann Date: Fri, 17 Jan 2020 09:47:02 -0600 Subject: [PATCH 2/5] Consolidate file ownership fixing logic. --- tasks/main.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 5726c0d..6ee5210 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -69,15 +69,6 @@ group: "{{ deploydrupal_checkout_user }}" mode: ug-w -- name: update files directory owner and permissions. - file: - path: "{{ deploydrupal_core_path }}/sites/{{ deploydrupal_site_name }}/files" - state: directory - owner: "{{ deploydrupal_apache_user }}" - group: "{{ deploydrupal_checkout_user }}" - mode: 0770 - become: "{{ deploydrupal_files_become }}" - - name: clear drush cache. shell: "{{ deploydrupal_drush_path }} cache-clear drush" args: @@ -105,9 +96,8 @@ owner: "{{ deploydrupal_apache_user }}" group: "{{ deploydrupal_checkout_user }}" mode: 0770 - recurse: yes + recurse: "{{ deploydrupal_site_install }}" become: "{{ deploydrupal_files_become }}" - when: deploydrupal_site_install_config # Import the latest configuration. This includes the latest # configuration_split configuration. Importing this twice ensures that the From e07fa6f0d887a3f554aaa262237c0e93a13b1bb1 Mon Sep 17 00:00:00 2001 From: Adam Zimmermann Date: Fri, 17 Jan 2020 12:34:15 -0600 Subject: [PATCH 3/5] Add loop and directory defaults. --- defaults/main.yml | 5 +++++ tasks/main.yml | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index a97e393..41c6499 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -53,3 +53,8 @@ deploydrupal_npm_theme_run_commands: [] # Rebuild Drupal cache. deploydrupal_drush_cache_rebuild: true + +# Site file directory folders that need permission fixes after site install. +deploydrupal_file_permission_fix_directories: + - 'styles' + - 'media-icons' diff --git a/tasks/main.yml b/tasks/main.yml index 6ee5210..27a88d3 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -69,6 +69,15 @@ group: "{{ deploydrupal_checkout_user }}" mode: ug-w +- name: update files directory owner and permissions. + file: + path: "{{ deploydrupal_core_path }}/sites/{{ deploydrupal_site_name }}/files" + state: directory + owner: "{{ deploydrupal_apache_user }}" + group: "{{ deploydrupal_checkout_user }}" + mode: 0770 +- become: "{{ deploydrupal_files_become }}" + - name: clear drush cache. shell: "{{ deploydrupal_drush_path }} cache-clear drush" args: @@ -91,13 +100,13 @@ - name: adjust files directory sub-folder permissions after site install. file: - path: "{{ deploydrupal_core_path }}/sites/{{ deploydrupal_site_name }}/files" + path: "{{ deploydrupal_core_path }}/sites/{{ deploydrupal_site_name }}/files/{{ item }}" state: directory owner: "{{ deploydrupal_apache_user }}" group: "{{ deploydrupal_checkout_user }}" mode: 0770 - recurse: "{{ deploydrupal_site_install }}" become: "{{ deploydrupal_files_become }}" + with_items: "{{ deploydrupal_file_permission_fix_directories }}" # Import the latest configuration. This includes the latest # configuration_split configuration. Importing this twice ensures that the From 5b43feb3750f91087c734dcae442cb92ce4c69b2 Mon Sep 17 00:00:00 2001 From: Adam Zimmermann Date: Fri, 17 Jan 2020 12:42:10 -0600 Subject: [PATCH 4/5] Fix yml format. --- tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index 27a88d3..d0bc999 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -76,7 +76,7 @@ owner: "{{ deploydrupal_apache_user }}" group: "{{ deploydrupal_checkout_user }}" mode: 0770 -- become: "{{ deploydrupal_files_become }}" + become: "{{ deploydrupal_files_become }}" - name: clear drush cache. shell: "{{ deploydrupal_drush_path }} cache-clear drush" From 083af0c200ee43d2f4327f3a88a446c8e2bf2b02 Mon Sep 17 00:00:00 2001 From: Adam Zimmermann Date: Fri, 17 Jan 2020 12:43:45 -0600 Subject: [PATCH 5/5] Add when condition. --- tasks/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tasks/main.yml b/tasks/main.yml index d0bc999..0907a05 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -107,6 +107,8 @@ mode: 0770 become: "{{ deploydrupal_files_become }}" with_items: "{{ deploydrupal_file_permission_fix_directories }}" + when: + - deploydrupal_site_install # Import the latest configuration. This includes the latest # configuration_split configuration. Importing this twice ensures that the