# 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: Stop '{{ apache_service }}' systemd service systemd: name: "{{ apache_service }}" # apache2 or httpd, per /opt/iiab/iiab/vars/.yml state: stopped ignore_errors: yes - 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 }}" # www-data or apache, per /opt/iiab/iiab/vars/.yml groups: shadow - name: Remove NGINX default config /etc/nginx/sites-enabled/default file: path: /etc/nginx/sites-enabled/default state: absent - name: 'Install 2 (of 4) files from template: /etc/nginx/server.conf, /etc/nginx/nginx.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" } # 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 # 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: php_version != "7.4" #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'