1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00
iiab/roles/www_front_end/tasks/main.yml
2020-02-15 22:49:27 -05:00

76 lines
2.7 KiB
YAML

# Role "www_back_end" runs earlier, likely in 3-BASE-SERVER.
# Role "www_front_end" runs here, probably in 4-SERVER-OPTIONS.
#
# (Don't take either name too literally!)
# HOMEPAGE
- name: Create dir {{ doc_root }}{{ iiab_home_url }} just in case variable iiab_home_url was customized. (Standard path {{doc_root}}/home was created earlier.)
file:
state: directory
path: "{{ doc_root }}{{ iiab_home_url }}" # /library/www/html/home
owner: "{{ apache_user }}"
group: "{{ apache_user }}"
mode: '0755'
# Used to be run by httpd/tasks/install.yml
- name: "IN CASE NGINX IS DISABLED: Enable IIAB pages via Apache (e.g. on port 80) if apache_install"
include_tasks: roles/httpd/tasks/homepage.yml
when: apache_install | bool
# Used to be run by nginx/tasks/install.yml
- name: Enable IIAB pages via NGINX (e.g. on port 80) if nginx_install
include_tasks: roles/nginx/tasks/homepage.yml
when: nginx_install | bool
# 'Is a "Rapid Power Off" button possible for low-electricity environments?'
# gives more details here: http://FAQ.IIAB.IO
# 2020-02-12: DOES THE FLAG BELOW (apache_allow_sudo) WORK WITH NGINX TOO ?
# COMPARE nginx_high_php_limits @ roles/www_back_end/tasks/main.yml
- name: Give {{ apache_user }} (per variable apache_user) permission to poweroff, installing /etc/sudoers.d/020_apache_poweroff from template
template:
src: 020_apache_poweroff.j2
dest: /etc/sudoers.d/020_apache_poweroff
mode: '0755'
when: apache_allow_sudo | bool
- name: Remove {{ apache_user }} (per variable apache_user) permission to poweroff, removing /etc/sudoers.d/020_apache_poweroff
file:
path: /etc/sudoers.d/020_apache_poweroff
state: absent
when: not apache_allow_sudo
- name: Run /usr/bin/iiab-refresh-wiki-docs (scraper script) to create http://box/info offline documentation. (This script was installed in Stage 3 = roles/3-base-server/tasks/main.yml, which ran roles/www_back_end/tasks/main.yml)
command: /usr/bin/iiab-refresh-wiki-docs
when: internet_available and not nodocs
- name: (Re)Start '{{ apache_service }}' systemd service, if apache_enabled
systemd:
name: "{{ apache_service }}" # apache2 on debuntu
state: restarted
when: apache_enabled | bool
- name: (Re)Start 'nginx' systemd service, if nginx_enabled
systemd:
name: nginx
state: restarted
when: nginx_enabled | bool
# RECORD www_front_end AS INSTALLED
- name: "Set 'www_front_end_installed: True'"
set_fact:
www_front_end_installed: True
- name: "Add 'www_front_end_installed: True' to {{ iiab_state_file }}"
lineinfile:
path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
regexp: '^www_front_end_installed'
line: 'www_front_end_installed: True'