1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 03:32:12 +00:00
iiab/roles/nginx/tasks/install.yml

82 lines
2.9 KiB
YAML
Raw Normal View History

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" }
2020-02-12 21:49:43 +00:00
- name: Stop '{{ apache_service }}' systemd service
systemd:
name: "{{ apache_service }}" # apache2 or httpd, per /opt/iiab/iiab/vars/<OS>.yml
state: stopped
ignore_errors: yes
2020-02-12 08:08:16 +00:00
- 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:
2020-02-12 21:49:43 +00:00
name: "{{ apache_user }}" # www-data or apache, per /opt/iiab/iiab/vars/<OS>.yml
2019-11-20 08:32:05 +00:00
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
- name: 'Install 2 (of 4) files from template: /etc/nginx/server.conf, /etc/nginx/nginx.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" } # Moved into homepage.yml below
- debug:
msg: roles/nginx/tasks/homepage.yml will run LATER (invoked by roles/www_options/tasks/main.yml) SO THAT NGINX CAN REDIRECT http://box TO http://box{{ iiab_home_url }} (based on var iiab_home_url)
# - include_tasks: roles/nginx/tasks/homepage.yml
# php-stem extension installed by roles/www_base/tasks/php-stem.yml
2020-01-25 20:03:01 +00:00
# here it is linked to php-fpm
2020-04-18 18:44:15 +00:00
# we skip any errors which probably due to the lack of the .so for the current platform
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-04-18 18:44:15 +00:00
ignore_errors: yes
#when: php_version != 7.4
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
- 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'