PHP works
parent
1d025d1f35
commit
721606056d
|
@ -23,8 +23,8 @@
|
|||
with_fileglob: '../templates/etc/nginx/helpers/*.j2'
|
||||
notify: reload nginx
|
||||
|
||||
- name: INCLUDE | PHP configuration
|
||||
include: php.yml
|
||||
- name: INCLUDE | Upstream configuration
|
||||
include: upstream.yml
|
||||
when: nginx_php
|
||||
|
||||
- name: INCLUDE | Vhosts configuration
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
---
|
||||
|
||||
- name: INCLUDE_VARS | Include PHP defaults vars from PHP role if unspecified
|
||||
include_vars: ../../php/defaults/main.yml
|
||||
when: php_fpm_socket is undefined
|
||||
|
||||
- name: TEMPLATE | Deploy PHP upstream (UNIX sockets) to Nginx
|
||||
template: src=etc/nginx/upstream/php.conf.j2 dest=/etc/nginx/conf.d/php.conf
|
||||
notify: reload nginx
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
|
||||
- name: TEMPLATE | Deploy PHP upstream to Nginx
|
||||
template: src=etc/nginx/upstream/php.conf.j2 dest=/etc/nginx/conf.d/php.conf
|
||||
notify: reload nginx
|
||||
|
|
@ -1,26 +1,22 @@
|
|||
#
|
||||
# {{ ansible_managed }}
|
||||
#
|
||||
|
||||
{% if nginx_php_method == 'unix' %}
|
||||
upstream php {
|
||||
{% for item in php_fpm_unix_sockets %}
|
||||
server unix:{{ item }};
|
||||
{% endfor %}
|
||||
}
|
||||
{% elif nginx_php_method == 'tcp' %}
|
||||
{% if nginx_php_method == 'tcp' %}
|
||||
upstream php {
|
||||
{% if nginx_cluster_php_method is defined %}
|
||||
{{ nginx_cluster_php_method }};
|
||||
{% endif %}
|
||||
{% for item in nginx_cluster_servers %}
|
||||
{% for item in nginx_php_tcp_sockets %}
|
||||
server {{ item.host }}:{{ item.port }} weight={{ item.weight | default('100') }} max_fails={{ item.max_fails | default('5') }} fail_timeout={{ item.fail_timeout | default('10s') }};
|
||||
{% endfor %}
|
||||
}
|
||||
{% elif nginx_php_method == 'unix' %}
|
||||
upstream php {
|
||||
{% for item in nginx_php_unix_sockets %}
|
||||
server unix:{{ item }};
|
||||
{% endfor %}
|
||||
}
|
||||
{% else %}
|
||||
#
|
||||
# Bad configuration...
|
||||
#
|
||||
{% endif %}
|
||||
|
||||
# vim:filetype=nginx
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
#
|
||||
# {{ ansible_managed }}
|
||||
#
|
||||
|
||||
upstream php {
|
||||
{% if nginx_cluster_php_method is defined %}
|
||||
{{ nginx_cluster_php_method }};
|
||||
{% endif %}
|
||||
{% for item in nginx_cluster_servers %}
|
||||
server {{ item.host }}:{{ item.port }} weight={{ item.weight | default('100') }} max_fails={{ item.max_fails | default('5') }} fail_timeout={{ item.fail_timeout | default('10s') }};
|
||||
{% endfor %}
|
||||
}
|
||||
|
||||
# vim:filetype=nginx
|
|
@ -1,13 +1,18 @@
|
|||
---
|
||||
|
||||
- hosts: all
|
||||
pre_tasks:
|
||||
- apt: pkg=php5-fpm update_cache=yes cache_valid_time=3600 state=present
|
||||
vars:
|
||||
nginx_php: true
|
||||
nginx_vhosts:
|
||||
- name: 'test.local'
|
||||
template: 'static'
|
||||
ssl:
|
||||
use: false
|
||||
generatekey: false
|
||||
template: 'strong'
|
||||
- name: 'test-php.local'
|
||||
template: 'wordpress'
|
||||
ssl:
|
||||
use: false
|
||||
roles:
|
||||
- ../../
|
||||
|
|
Loading…
Reference in New Issue