You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
109 lines
3.2 KiB
109 lines
3.2 KiB
---
|
|
|
|
- name: Manage nginx webserver
|
|
collections: [ 'debops.debops', 'debops.roles01',
|
|
'debops.roles02', 'debops.roles03' ]
|
|
hosts: [ 'debian10' ]
|
|
become: True
|
|
|
|
environment: '{{ inventory__environment | d({})
|
|
| combine(inventory__group_environment | d({}))
|
|
| combine(inventory__host_environment | d({})) }}'
|
|
|
|
|
|
vars_files:
|
|
- ./../vars/nginx.yml
|
|
|
|
vars:
|
|
nginx_acme: False
|
|
nginx_http_extra_options: |
|
|
client_max_body_size 100M;
|
|
nginx_real_ip_from: ['172.16.30.0/24']
|
|
nginx_default_keepalive_timeout: 65
|
|
# nginx_webroot_create: False
|
|
nginx_ocsp: False
|
|
nginx_worker_processes: auto
|
|
nginx__servers:
|
|
- name: '{{ lxc_host }}'
|
|
|
|
type: php
|
|
|
|
root: '/var/www/{{ lxc_host }}'
|
|
|
|
public_dir_name: ''
|
|
|
|
include_files_begin: '{{ nginx_includes_begin }}'
|
|
|
|
options: set $upstream unix:/run/php7.4-fpm-www-data.sock;
|
|
|
|
location_list:
|
|
- pattern: '/'
|
|
options: rewrite ^/.*$ /index.php last;
|
|
locations:
|
|
- pattern: '~ ^/*.-backend/'
|
|
options: set $upstream unix:/run/php7.4-fpm-backend.sock;
|
|
- pattern: '~* ^(?!/index).*\.php$'
|
|
options: return 403;
|
|
|
|
php_options: |
|
|
fastcgi_read_timeout 3000;
|
|
php_upstream: $upstream
|
|
|
|
#location ~ ^(?!.+\.php/)(?<script_name>.+\.php)$ {
|
|
php_location_script_name: ~ ^(?<script_name>/index\.php)
|
|
|
|
#location ~ ^(?<script_name>.+?\.php)(?<path_info>/.*)?$ {
|
|
php_location_path_info: ~ ^(?<script_name>/index\.php)(?<path_info>/.*)?
|
|
|
|
pre_tasks:
|
|
- name: Set filtered includes
|
|
set_fact:
|
|
nginx_includes_begin: "{{ (nginx_includes_begin | default([])) | union([item]) }}"
|
|
when: item != omit
|
|
loop:
|
|
- "{{ (nginx_www_redirect | default(False)) | ternary('includes.d/www.conf', omit) }}"
|
|
- includes.d/octobercms.conf
|
|
- includes.d/staticfiles.conf
|
|
|
|
- name: Copy OctoberCMS nginx conf includes and www redirect
|
|
copy:
|
|
src: etc/nginx/includes.d
|
|
dest: /etc/nginx/
|
|
mode: 0644
|
|
|
|
post_tasks:
|
|
- name: Default index.html
|
|
template:
|
|
src: var/www/lxc_host/index.html.j2
|
|
dest: '/var/www/{{ lxc_host }}/index.html'
|
|
mode: 0644
|
|
owner: '{{ lxc_host }}'
|
|
|
|
- name: Copy normalized.css
|
|
template:
|
|
src: var/www/lxc_host/normalize.css
|
|
dest: '/var/www/{{ lxc_host }}/'
|
|
mode: 0644
|
|
owner: '{{ lxc_host }}'
|
|
|
|
roles:
|
|
|
|
# - role: keyring
|
|
# tags: [ 'role::keyring', 'skip::keyring', 'role::nginx' ]
|
|
# keyring__dependent_apt_keys:
|
|
# - '{{ nginx__keyring__dependent_apt_keys }}'
|
|
#
|
|
# - role: apt_preferences
|
|
# tags: [ 'role::apt_preferences', 'skip::apt_preferences' ]
|
|
# apt_preferences__dependent_list:
|
|
# - '{{ nginx__apt_preferences__dependent_list }}'
|
|
#
|
|
# - role: python
|
|
# tags: [ 'role::python', 'skip::python' ]
|
|
# python__dependent_packages3:
|
|
# - '{{ nginx__python__dependent_packages3 }}'
|
|
# python__dependent_packages2:
|
|
# - '{{ nginx__python__dependent_packages2 }}'
|
|
|
|
- role: nginx
|
|
tags: [ 'role::nginx', 'skip::nginx' ]
|