2020-02-12 08:08:16 +00:00
|
|
|
# This stanza can likely be removed later in 2020:
|
|
|
|
- name: 'Remove legacy files if present: /etc/systemd/system/uwsgi.service, {{ nginx_conf_dir }}/usb-lib.conf, {{ nginx_conf_dir }}/modules.conf'
|
|
|
|
file:
|
|
|
|
path: "{{ item.path }}"
|
|
|
|
state: absent
|
|
|
|
with_items:
|
|
|
|
- { path: "/etc/systemd/system/uwsgi.service" }
|
|
|
|
- { path: "{{ nginx_conf_dir }}/usb-lib.conf" }
|
|
|
|
- { path: "{{ nginx_conf_dir }}/modules.conf" }
|
|
|
|
|
|
|
|
- name: Install required and helper packages for NGINX
|
2020-01-12 00:00:39 +00:00
|
|
|
package:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: present
|
2019-11-20 08:32:05 +00:00
|
|
|
with_items:
|
|
|
|
- nginx-extras
|
|
|
|
- uwsgi
|
|
|
|
- uwsgi-plugin-python3
|
|
|
|
- php-fpm
|
|
|
|
- libnginx-mod-http-subs-filter
|
|
|
|
|
2020-02-12 08:08:16 +00:00
|
|
|
- name: Add user '{{ apache_user }}' to shadow group, so it can authenticate Admin Console
|
2019-11-20 08:32:05 +00:00
|
|
|
user:
|
|
|
|
name: "{{ apache_user }}"
|
|
|
|
groups: shadow
|
|
|
|
|
2020-01-12 00:00:39 +00:00
|
|
|
- name: Remove NGINX default config /etc/nginx/sites-enabled/default
|
2019-11-20 08:32:05 +00:00
|
|
|
file:
|
|
|
|
path: /etc/nginx/sites-enabled/default
|
|
|
|
state: absent
|
2019-11-20 08:46:55 +00:00
|
|
|
|
2020-02-12 08:08:16 +00:00
|
|
|
- name: 'Install 3-or-4 files from template: /etc/nginx/server.conf, /etc/nginx/nginx.conf, /etc/{{ apache_service }}/ports.conf'
|
2019-11-20 08:46:55 +00:00
|
|
|
template:
|
2020-01-12 00:00:39 +00:00
|
|
|
src: "{{ item.src }}"
|
|
|
|
dest: "{{ item.dest }}"
|
2019-11-20 08:46:55 +00:00
|
|
|
with_items:
|
2020-02-12 08:08:16 +00:00
|
|
|
- { src: 'server.conf.j2', dest: '/etc/nginx/server.conf' }
|
|
|
|
- { src: 'nginx.conf.j2', dest: '/etc/nginx/nginx.conf' }
|
|
|
|
#- { src: 'ports.conf.j2', dest: '/etc/{{ apache_service }}/ports.conf' } # Moved to enable-or-disable.yml
|
|
|
|
- { src: 'iiab.conf.j2', dest: "{{ nginx_conf_dir }}/iiab.conf" }
|
2019-12-05 20:54:00 +00:00
|
|
|
|
2020-02-12 08:08:16 +00:00
|
|
|
# php-stem extension installed by roles/web_support/tasks/php-stem.yml
|
2020-01-25 20:03:01 +00:00
|
|
|
# here it is linked to php-fpm
|
2020-02-12 08:08:16 +00:00
|
|
|
- name: Symlink /etc/php/{{ php_version }}/fpm/conf.d/20-stem.ini -> /etc/php/{{ php_version }}/mods-available/stem.ini
|
2020-01-25 20:03:01 +00:00
|
|
|
file:
|
|
|
|
src: "/etc/php/{{ php_version }}/mods-available/stem.ini"
|
|
|
|
path: "/etc/php/{{ php_version }}/fpm/conf.d/20-stem.ini"
|
|
|
|
state: link
|
2020-02-12 08:08:16 +00:00
|
|
|
#when: nginx_enabled | bool
|
2020-01-25 20:03:01 +00:00
|
|
|
|
2020-02-12 08:08:16 +00:00
|
|
|
- name: Restart php{{ php_version }}-fpm systemd service
|
|
|
|
systemd:
|
2020-01-25 20:03:01 +00:00
|
|
|
name: "php{{ php_version }}-fpm"
|
|
|
|
state: restarted
|
2020-02-12 08:08:16 +00:00
|
|
|
#when: nginx_enabled | bool
|
2020-01-25 20:03:01 +00:00
|
|
|
|
2020-01-30 09:00:00 +00:00
|
|
|
|
|
|
|
# RECORD NGINX AS INSTALLED
|
|
|
|
|
|
|
|
- name: "Set 'nginx_installed: True'"
|
|
|
|
set_fact:
|
|
|
|
nginx_installed: True
|
|
|
|
|
2020-01-12 23:15:33 +00:00
|
|
|
- name: "Add 'nginx_installed: True' to {{ iiab_state_file }}"
|
2020-01-12 22:06:24 +00:00
|
|
|
lineinfile:
|
2020-02-04 00:54:04 +00:00
|
|
|
path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
|
2020-01-12 22:06:24 +00:00
|
|
|
regexp: '^nginx_installed'
|
|
|
|
line: 'nginx_installed: True'
|