2023-06-10 13:10:47 +00:00
- name : Record (initial) disk space used
shell : df -B1 --output=used / | tail -1
2023-05-27 07:26:04 +00:00
register : df1
2021-08-11 16:32:53 +00:00
- name : Stop & Disable '{{ apache_service }}' systemd service, in case it exists
2020-02-12 21:49:43 +00:00
systemd :
name : "{{ apache_service }}" # apache2 or httpd, per /opt/iiab/iiab/vars/<OS>.yml
state : stopped
2021-08-11 14:50:13 +00:00
enabled : no
2020-05-17 05:06:48 +00:00
ignore_errors : yes
2021-08-08 02:42:38 +00:00
# 'when: apache_installed is defined' insuff b/c mysql's php (etc) can install apache2
2020-02-12 21:49:43 +00:00
2021-06-28 13:32:46 +00:00
- name: 'Install 5 packages for NGINX : libnginx-mod-http-subs-filter, nginx-extras, php{{ php_version }}-fpm, uwsgi, uwsgi-plugin-python3'
2020-01-12 00:00:39 +00:00
package :
2021-05-21 20:40:19 +00:00
name :
- libnginx-mod-http-subs-filter
- nginx-extras
2021-07-07 04:13:52 +00:00
- php{{ php_version }}-fpm # INSTALLS [0] /etc/apache2/conf-available/php{{ php_version }}-fpm.conf AND DRAGS IN [1] php{{ php_version }}-cli (superset of php{{ php_version }}-common) [2] libsodium23 (likewise installed in moodle/tasks/install.yml AND wordpress/tasks/install.yml) [3] php{{ php_version }}-json if PHP < 8.0 (NEEDED FOR nextcloud/tasks/install.yml AND pbx/tasks/freepbx_dependencies.yml AND wordpress/tasks/install.yml)
2021-06-28 17:13:42 +00:00
- uwsgi # Admin Console & roles/captiveportal should really install
- uwsgi-plugin-python3 # these 2 packages on demand (not every IIAB needs these).
2020-01-12 00:00:39 +00:00
state : present
2019-11-20 08:32:05 +00:00
2021-08-08 02:37:04 +00:00
# 2021-08-07: Legacy from roles/httpd/tasks/install.yml
# - name: 'Create group: admin'
# group:
# name: admin
2020-10-16 18:00:30 +00:00
# 2020-10-16: Removed per #2560
2021-08-08 00:15:07 +00:00
# - 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/<OS>.yml
# groups: shadow
2021-08-08 02:37:04 +00:00
# - name: Add user {{ apache_user }} (from variable apache_user) to groups admin, shadow
2021-08-08 00:15:07 +00:00
# user:
# name: "{{ apache_user }}" # www-data on Debuntu
# #groups: admin,shadow
# groups: shadow # 2020-06-04: shadow nec for Admin Console login (this line had been clobbering user www-data's membership in group shadow, as set earlier by nginx/tasks/install.yml, SEE #2431)
# createhome: no
# append: yes
2019-11-20 08:32:05 +00:00
2021-08-08 02:37:04 +00:00
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
2021-08-09 12:01:36 +00:00
- name: 'Install 3 (of 5) files from template : /etc/nginx/server.conf, /etc/nginx/nginx.conf, /etc/nginx/mime.types'
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' }
2020-07-15 20:16:03 +00:00
- { src: 'mime.types.j2', dest : '/etc/nginx/mime.types' }
2021-08-09 12:01:36 +00:00
# - { src: 'ports.conf', dest: '/etc/{{ apache_service }}/ports.conf' } # 2021-08-09: Restored from enable-or-disable.yml then moved to roles/pbx/tasks/apache.yml
2021-08-08 02:42:38 +00:00
# - { src: 'iiab.conf.j2', dest: "{{ nginx_conf_dir }}/iiab.conf" } # Moved into homepage.yml, invoked later by roles/www_options/tasks/main.yml (see below!)
2019-12-05 20:54:00 +00:00
2020-02-13 01:53:36 +00:00
- debug :
2020-03-08 19:26:05 +00:00
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)
2020-02-13 01:53:36 +00:00
# - include_tasks: roles/nginx/tasks/homepage.yml
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-01-30 09:00:00 +00:00
# RECORD NGINX AS INSTALLED
2023-06-10 13:10:47 +00:00
- name : Record (final) disk space used
shell : df -B1 --output=used / | tail -1
2023-05-27 07:26:04 +00:00
register : df2
2023-06-10 13:10:47 +00:00
- name : Add 'nginx_disk_usage = {{ df2.stdout|int - df1.stdout|int }}' to {{ iiab_ini_file }}
2023-05-27 07:26:04 +00:00
ini_file :
path : "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
section : nginx
option : nginx_disk_usage
2023-06-10 13:10:47 +00:00
value : "{{ df2.stdout|int - df1.stdout|int }}"
2023-05-27 07:26:04 +00:00
2020-01-30 09:00:00 +00:00
- 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 '