From fa5db39674c783c3e7f5fb552996d8a8d7a5366e Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Thu, 26 Apr 2018 17:09:09 +0300 Subject: [PATCH] roles/nginx: Move WordPress tasks to separate file Because of the shift from static imports to dynamic includes these tags will never be reached unless they have their own task that is tagged at the top-level (dynamic includes don't pass their tags to their children). --- roles/nginx/tasks/main.yml | 5 +++++ roles/nginx/tasks/vhosts.yml | 12 ------------ roles/nginx/tasks/wordpress.yml | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 roles/nginx/tasks/wordpress.yml diff --git a/roles/nginx/tasks/main.yml b/roles/nginx/tasks/main.yml index d49aba3..68c53aa 100644 --- a/roles/nginx/tasks/main.yml +++ b/roles/nginx/tasks/main.yml @@ -39,6 +39,11 @@ when: nginx_vhosts is defined tags: nginx +- name: Configure WordPress + include_tasks: wordpress.yml + when: nginx_vhosts is defined + tags: wordpress + - name: Configure blank nginx vhost template: src=blank-vhost.conf.j2 dest={{ nginx_confd_path }}/blank-vhost.conf mode=0644 owner=root group=root notify: diff --git a/roles/nginx/tasks/vhosts.yml b/roles/nginx/tasks/vhosts.yml index bc3d4aa..758f3fe 100644 --- a/roles/nginx/tasks/vhosts.yml +++ b/roles/nginx/tasks/vhosts.yml @@ -20,18 +20,6 @@ - name: Create vhost document roots file: path={{ nginx_root_prefix }}/{{ item.domain_name }} state=directory mode=0755 owner=nginx group=nginx loop: "{{ nginx_vhosts }}" - - - name: Install WordPress - git: repo=https://github.com/WordPress/WordPress.git dest={{ nginx_root_prefix }}/{{ item.domain_name }}/wordpress version={{ item.wordpress_version }} depth=1 force=yes - when: item.has_wordpress is defined and item.has_wordpress == True - loop: "{{ nginx_vhosts }}" - tags: wordpress - - - name: Fix WordPress directory permissions - file: path={{ nginx_root_prefix }}/{{ item.domain_name }} state=directory owner=nginx group=nginx recurse=yes - when: item.has_wordpress is defined and item.has_wordpress == True - loop: "{{ nginx_vhosts }}" - tags: wordpress tags: nginx # vim: set ts=2 sw=2: diff --git a/roles/nginx/tasks/wordpress.yml b/roles/nginx/tasks/wordpress.yml new file mode 100644 index 0000000..5b44880 --- /dev/null +++ b/roles/nginx/tasks/wordpress.yml @@ -0,0 +1,15 @@ +--- + +- block: + - name: Install WordPress + git: repo=https://github.com/WordPress/WordPress.git dest={{ nginx_root_prefix }}/{{ item.domain_name }}/wordpress version={{ item.wordpress_version }} depth=1 force=yes + when: item.has_wordpress is defined and item.has_wordpress == True + loop: "{{ nginx_vhosts }}" + + - name: Fix WordPress directory permissions + file: path={{ nginx_root_prefix }}/{{ item.domain_name }} state=directory owner=nginx group=nginx recurse=yes + when: item.has_wordpress is defined and item.has_wordpress == True + loop: "{{ nginx_vhosts }}" + tags: wordpress + +# vim: set ts=2 sw=2: