1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-12 19:22:24 +00:00
iiab/roles/nginx/tasks/install.yml
2020-02-12 06:57:14 -05:00

68 lines
2.3 KiB
YAML

# 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
package:
name: "{{ item }}"
state: present
with_items:
- nginx-extras
- uwsgi
- uwsgi-plugin-python3
- php-fpm
- libnginx-mod-http-subs-filter
- name: Add user '{{ apache_user }}' to shadow group, so it can authenticate Admin Console
user:
name: "{{ apache_user }}"
groups: shadow
- name: Remove NGINX default config /etc/nginx/sites-enabled/default
file:
path: /etc/nginx/sites-enabled/default
state: absent
- name: 'Install 3 files from template: /etc/nginx/server.conf, /etc/nginx/nginx.conf, {{ nginx_conf_dir }}/iiab.conf'
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
with_items:
- { 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" } # /etc/nginx/conf.d
# php-stem extension installed by roles/web_support/tasks/php-stem.yml
# here it is linked to php-fpm
- name: Symlink /etc/php/{{ php_version }}/fpm/conf.d/20-stem.ini -> /etc/php/{{ php_version }}/mods-available/stem.ini
file:
src: "/etc/php/{{ php_version }}/mods-available/stem.ini"
path: "/etc/php/{{ php_version }}/fpm/conf.d/20-stem.ini"
state: link
#when: nginx_enabled | bool
- name: Restart php{{ php_version }}-fpm systemd service
systemd:
name: "php{{ php_version }}-fpm"
state: restarted
#when: nginx_enabled | bool
# RECORD NGINX AS INSTALLED
- name: "Set 'nginx_installed: True'"
set_fact:
nginx_installed: True
- name: "Add 'nginx_installed: True' to {{ iiab_state_file }}"
lineinfile:
path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
regexp: '^nginx_installed'
line: 'nginx_installed: True'