2020-06-15 20:04:34 +00:00
- name: 'Install 4 packages : apache2, libapache2-mod-php{{ php_version }}, php{{ php_version }}, php{{ php_version }}-curl'
2019-08-24 18:52:25 +00:00
package :
#name: [u'apache2', u'php{{ php_version }}', u'php{{ php_version }}-curl'] # FAILS ('u' for Unicode strings)
#name: ['apache2', 'php{{ php_version }}', 'php{{ php_version }}-curl'] # WORKS?
name :
2020-06-04 19:30:40 +00:00
- "{{ apache_service }}" # apache2 on Debuntu
2020-06-15 20:04:34 +00:00
- "libapache2-mod-php{{ php_version }}" # 2020-06-15: Required (e.g. for Elgg, Moodle & possibly others) now that mysql/tasks/install.yml installs "php{{ php_version }}-common" rather than the full "php{{ php_version }}"
2020-07-07 18:02:00 +00:00
# - "php{{ php_version }}"
# - "php{{ php_version }}-curl"
2019-08-24 18:52:25 +00:00
state : present
2020-10-16 20:46:19 +00:00
when : is_debuntu
# when: is_debian
2019-08-24 18:52:25 +00:00
2020-06-15 20:04:34 +00:00
# - name: 'Install 2 packages: apache2, php (ubuntu)'
# package:
# #name: [u'apache2', u'php'] # FAILS ('u' for Unicode strings)
# #name: ['apache2', 'php'] # WORKS
# name:
# - "{{ apache_service }}" # apache2 on Debuntu
# - php
# state: present
2020-10-16 20:46:19 +00:00
# when: is_ubuntu
2019-08-24 18:52:25 +00:00
# 2019-05-30: It's interesting that http://box.lan/admin and everything seems
# to work even without php{{ php_version }}-sqlite3 as confirmed on Ubuntu
# 16.04 (SEE PR #1697). And likely all others? @tim-moody writes "I think
# we decided that because sqlite3 and php are part of the base install the
# connector should be too."
#
# We might *try* deprecating this here as we transition beyond {raspbian-9,
# debian-9, ubuntu-18} in coming months to verify that roles/osm-vector-maps
# is the only role that needs it?
#
# Legacy Comment: SQLite3 no longer included in another package
2020-07-07 18:02:00 +00:00
#- name: Install php{{ php_version }}-sqlite3 (raspbian-9+ or debian-9+ or ubuntu-18+)
# package:
# name: "php{{ php_version }}-sqlite3"
# #when: is_raspbian_9 or is_debian_9 or is_ubuntu_18
# when: is_debuntu and (not is_debian_8) and (not is_ubuntu_16)
# #when: (is_debian and ansible_distribution_major_version == "9") or is_ubuntu_18
2019-08-24 18:52:25 +00:00
- name: 'Install 4 packages : httpd, mod_authnz_external, php, php-curl (redhat)'
package :
#name: [u'httpd', u'php', u'php-curl', u'mod_authnz_external'] # FAILS ('u' for Unicode strings)
#name: ['httpd', 'php', 'php-curl', 'mod_authnz_external'] # WORKS
name :
- httpd
- mod_authnz_external
- php
- php-curl
state : present
2020-10-16 20:46:19 +00:00
when : is_redhat
2019-08-24 18:52:25 +00:00
2020-02-12 08:08:16 +00:00
# Remove symlinks for mpm_event, replace with mpm_prefork
2019-08-24 18:52:25 +00:00
- name : Remove both mpm_event symlinks from /etc/apache2/mods-enabled (debuntu)
file :
path : "/etc/apache2/mods-enabled/{{ item }}"
state : absent
with_items :
- mpm_event.conf
- mpm_event.load
2020-10-16 20:46:19 +00:00
when : is_debuntu
2019-08-24 18:52:25 +00:00
- name : Create both mpm_prefork symlinks from /etc/apache2/mods-enabled to /etc/apache2/mods-available (debuntu)
file :
src : "/etc/apache2/mods-available/{{ item }}"
path : "/etc/apache2/mods-enabled/{{ item }}"
state : link
with_items :
- mpm_prefork.conf
- mpm_prefork.load
2020-10-16 20:46:19 +00:00
when : is_debuntu
2019-08-24 18:52:25 +00:00
- name : 'Enable 5 Apache modules, as with "a2enmod" command: headers, proxy, proxy_html, proxy_http, rewrite (for http://box/kiwix, http://box/kolibri, http://box/nodered, etc--if debuntu)'
apache2_module :
name : "{{ item }}"
2019-11-20 16:54:36 +00:00
with_items :
2019-08-24 18:52:25 +00:00
- headers
- proxy
- proxy_html
- proxy_http
- rewrite
2020-10-16 20:46:19 +00:00
when : is_debuntu
2019-08-24 18:52:25 +00:00
- name : Remove 000-default.conf from /etc/apache2 and /etc/apache2/sites-enabled (debuntu)
file :
path : "{{ item }}"
state : absent
with_items :
- /etc/apache2/000-default.conf # Not nec on Raspbian. Is this really still needed elsewhere?
- /etc/apache2/sites-enabled/000-default.conf
2020-10-16 20:46:19 +00:00
when : is_debuntu
2019-08-24 18:52:25 +00:00
- name : Create Apache's pid dir /var/run/{{ apache_user }}
file :
2020-02-12 08:08:16 +00:00
state : directory
2020-06-04 19:30:40 +00:00
path : "/var/run/{{ apache_user }}" # www-data on Debuntu
2020-05-18 21:33:30 +00:00
#owner: root
#group: root
#mode: '0755'
2019-08-24 18:52:25 +00:00
- name: 'Create group : admin'
group :
name : admin
2020-06-04 19:22:21 +00:00
- name : Add user {{ apache_user }} (from variable apache_user) to groups admin,shadow
2019-08-24 18:52:25 +00:00
user :
2020-06-04 19:30:40 +00:00
name : "{{ apache_user }}" # www-data on Debuntu
2020-06-04 19:22:21 +00:00
groups: admin,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)
2019-08-24 18:52:25 +00:00
createhome : no
2020-05-18 21:33:30 +00:00
- name : Create Apache dir /var/log/{{ apache_service }} ({{ apache_user }}:{{ apache_user }})
2019-08-24 18:52:25 +00:00
file :
2020-02-12 08:08:16 +00:00
state : directory
2020-06-04 19:30:40 +00:00
path : "/var/log/{{ apache_service }}" # apache2 on Debuntu
owner : "{{ apache_user }}" # www-data on Debuntu
2019-08-24 18:52:25 +00:00
group : "{{ apache_user }}"
2020-05-18 21:33:30 +00:00
#mode: '0755'
2019-08-24 18:52:25 +00:00
2020-02-12 12:23:17 +00:00
2020-02-12 08:08:16 +00:00
- name : Install Apache's 010-iiab.conf & proxy_ajp.conf into /etc/apache2/sites-available, from templates
template :
src : "{{ item.src }}"
dest : "{{ item.dest }}"
with_items :
- { src: 'roles/httpd/templates/010-iiab.conf.j2', dest : '/etc/{{ apache_conf_dir }}/010-iiab.conf' }
- { src: 'roles/httpd/templates/proxy_ajp.conf.j2', dest : '/etc/{{ apache_conf_dir }}/proxy_ajp.conf' }
2020-02-12 10:23:57 +00:00
- name : "IN CASE NGINX IS DISABLED: Enable IIAB pages via Apache (e.g. on port 80) by running 'a2ensite 010-iiab.conf'"
command : a2ensite 010-iiab.conf
2020-10-16 20:46:19 +00:00
#when: apache_enabled
2020-02-12 10:23:57 +00:00
# - name: Disable IIAB pages via Apache (e.g. on port 80) by running 'a2dissite 010-iiab.conf', if not apache_enabled"
# command: a2dissite 010-iiab.conf
# when: not apache_enabled
2020-05-18 21:33:30 +00:00
2020-02-13 01:53:36 +00:00
- debug :
2020-03-08 19:26:05 +00:00
msg : roles/httpd/tasks/homepage.yml will run LATER (invoked by roles/www_options/tasks/main.yml) SO THAT APACHE 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/httpd/tasks/homepage.yml
2020-02-12 10:23:57 +00:00
2020-05-18 21:33:30 +00:00
- name : Run 'systemctl daemon-reload'
systemd :
daemon_reload : yes
2020-01-12 22:06:24 +00:00
2020-01-30 09:00:00 +00:00
# RECORD Apache AS INSTALLED
- name : "Set 'apache_installed: True'"
set_fact :
apache_installed : True
2020-01-12 23:15:33 +00:00
- name : "Add 'apache_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 : '^apache_installed'
line: 'apache_installed : True '