roles/nginx: Updates to accomodate Debian 9 (stretch)

There are currently no nginx.org builds for Debian 9, so we need to
use the package from Debian's repository. This package provides a
www-data user and group instead of an nginx one.

We can revert some of this after Debian 9 is released and official
builds come from nginx.org (though it might be useful to keep the
main nginx.conf as a template).
This commit is contained in:
2017-01-30 15:43:03 +02:00
parent 8c3a8fc26a
commit 6de385021d
3 changed files with 35 additions and 3 deletions

View File

@ -17,9 +17,15 @@
- reload nginx
- name: Create vhost document roots
when: ansible_distribution_major_version | version_compare('9', '!=')
file: path={{ nginx_root_prefix }}/{{ item.domain_name }} state=directory mode=0755 owner=nginx group=nginx
with_items: "{{ nginx_vhosts }}"
- name: Create vhost document roots
when: ansible_distribution_major_version | version_compare('9', '==')
file: path={{ nginx_root_prefix }}/{{ item.domain_name }} state=directory mode=0755 owner=www-data group=www-data
with_items: "{{ 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
@ -28,7 +34,13 @@
- 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
when: item.has_wordpress is defined and item.has_wordpress == True and ansible_distribution_major_version | version_compare('9', '!=')
with_items: "{{ nginx_vhosts }}"
tags: wordpress
- name: Fix WordPress directory permissions
file: path={{ nginx_root_prefix }}/{{ item.domain_name }} state=directory owner=www-data group=www-data recurse=yes
when: item.has_wordpress is defined and item.has_wordpress == True and ansible_distribution_major_version | version_compare('9', '==')
with_items: "{{ nginx_vhosts }}"
tags: wordpress