2018-10-28 01:13:29 +00:00
- name : Install Apache's required packages (debian)
2018-02-07 00:26:57 +00:00
package :
2018-10-28 06:36:34 +00:00
name : [ u'apache2', u'php{{ php_version }}', u'php{{ php_version }}-curl']
2018-02-07 00:26:57 +00:00
state : present
2018-10-28 06:36:34 +00:00
when : is_debian
2017-05-27 18:09:50 +00:00
tags :
- download
2018-08-21 12:25:15 +00:00
- name : Debian changed SQLite name (debian-8)
2018-02-07 00:26:57 +00:00
package :
name : "php{{ php_version }}-sqlite"
2017-07-04 20:27:44 +00:00
when : is_debian and ansible_distribution_major_version == "8"
2018-08-21 12:25:15 +00:00
- name : Debian changed SQLite3 name (debian-9)
package :
name : "php{{ php_version }}-sqlite3"
2018-01-24 18:07:33 +00:00
when : is_debian and ansible_distribution_major_version == "9"
2017-07-04 20:27:44 +00:00
2018-10-28 01:13:29 +00:00
- name : Install Apache's required packages (ubuntu)
2018-09-23 23:25:45 +00:00
package :
2018-10-28 06:36:34 +00:00
name : [ u'apache2', u'php']
2018-09-23 23:25:45 +00:00
state : present
2018-10-28 06:36:34 +00:00
when : is_ubuntu
2018-09-23 23:25:45 +00:00
tags :
- download
2017-05-28 13:47:49 +00:00
2018-08-21 12:02:44 +00:00
- name : SQLite3 no longer included in another package (ubuntu-18)
2018-05-21 13:43:44 +00:00
package :
name : php{{ php_version }}-sqlite3
2018-05-21 13:53:18 +00:00
when : is_ubuntu_18
2018-05-21 13:43:44 +00:00
2018-10-28 01:13:29 +00:00
- name : Install Apache's required packages (redhat)
2018-02-07 00:26:57 +00:00
package :
2018-10-28 06:36:34 +00:00
name : [ u'httpd', u'php', u'php-curl', u'mod_authnz_external']
2018-02-07 00:26:57 +00:00
state : present
2018-10-28 06:36:34 +00:00
when : is_redhat
2017-05-27 18:09:50 +00:00
tags :
- download
2018-08-21 12:40:01 +00:00
# MOVED DOWN ~58 LINES
#- name: Remove the default apache2 config file (debuntu)
# file:
# path: /etc/apache2/sites-enabled/000-default.conf
# state: absent
# when: is_debuntu
2017-05-27 18:09:50 +00:00
2018-10-28 01:06:27 +00:00
- name : Install Apache's 010-iiab.conf & proxy_ajp.conf into /etc/apache2/sites-available, from templates
2018-02-07 00:26:57 +00:00
template :
backup : yes
src : "{{ item.src }}"
dest : "{{ item.dest }}"
owner : root
group : root
2018-10-28 06:18:54 +00:00
mode : 0644
2017-05-27 18:09:50 +00:00
with_items :
2018-10-28 06:18:54 +00:00
- { src: '010-iiab.conf.j2', dest : '/etc/{{ apache_config_dir }}/010-iiab.conf' }
- { src: 'proxy_ajp.conf.j2', dest : '/etc/{{ apache_config_dir }}/proxy_ajp.conf' }
2018-09-23 23:12:22 +00:00
#- { src: 'php.ini.j2', dest: '/etc/php.ini', mode: '0644' } # @jvonau suggests removing this in https://github.com/iiab/iiab/issues/1147
2017-05-27 18:09:50 +00:00
2018-09-23 23:25:45 +00:00
# For schools that use WordPress and/or Moodle intensively. See iiab/iiab #1147
# WARNING: Enabling this (might) cause excess use of RAM or other resources?
2018-09-24 16:33:55 +00:00
- name : Enact high limits in /etc/php/{{ php_version }}/{{ apache_service }}/php.ini if using WordPress and/or Moodle intensively
2018-09-23 23:25:45 +00:00
lineinfile :
path : "/etc/php/{{ php_version }}/{{ apache_service }}/php.ini"
regexp : "{{ item.regexp }}"
line : "{{ item.line }}"
2018-09-24 16:33:55 +00:00
when : apache_high_php_limits
2018-09-23 23:25:45 +00:00
with_items :
- { regexp: '^upload_max_filesize', line : 'upload_max_filesize = 64M ; default is 2M' }
- { regexp: '^post_max_size', line : 'post_max_size = 128M ; default is 8M' }
- { regexp: '^memory_limit', line : 'memory_limit = 256M ; default is 128M' }
- { regexp: '^max_execution_time', line : 'max_execution_time = 300 ; default is 30' }
- { regexp: '^max_input_time', line : 'max_input_time = 300 ; default is 60' }
2017-05-27 18:09:50 +00:00
# remove symlinks for mpm-event, replace with mpm-prefork
2018-10-28 06:18:54 +00:00
- name : Remove mpm event symlinks (debuntu)
2018-02-07 00:26:57 +00:00
file :
path : "/etc/apache2/mods-enabled/{{ item }}"
state : absent
2017-05-27 18:09:50 +00:00
with_items :
2018-02-07 00:26:57 +00:00
- mpm_event.conf
- mpm_event.load
2017-05-27 23:10:45 +00:00
when : is_debuntu
2017-05-27 18:09:50 +00:00
2018-02-07 00:26:57 +00:00
- name : Create symlinks for mpm-prefork (debuntu)
file :
src : "/etc/apache2/mods-available/{{ item }}"
2018-10-28 06:18:54 +00:00
path : "/etc/apache2/mods-enabled/{{ item }}"
2018-02-07 00:26:57 +00:00
state : link
2017-05-27 18:09:50 +00:00
with_items :
2018-02-08 23:03:50 +00:00
- mpm_prefork.conf
- mpm_prefork.load
2017-05-27 23:10:45 +00:00
when : is_debuntu
2017-05-27 18:09:50 +00:00
2018-02-07 00:26:57 +00:00
- name : Turn on mod_proxy (debuntu)
2017-05-27 18:09:50 +00:00
command : a2enmod {{ item }}
with_items :
2018-02-07 00:26:57 +00:00
- proxy
- proxy_html
- headers
- rewrite
2017-05-27 23:10:45 +00:00
when : is_debuntu
2017-05-27 18:09:50 +00:00
2018-10-28 06:18:54 +00:00
- name : Create 010-iiab.conf symlink enabling our site (debuntu)
2018-02-07 00:26:57 +00:00
file :
2018-10-28 06:18:54 +00:00
src : "/etc/{{ apache_config_dir }}/010-iiab.conf"
path : /etc/apache2/sites-enabled/010-iiab.conf
2018-02-07 00:26:57 +00:00
state : link
2017-05-27 23:10:45 +00:00
when : is_debuntu
2017-05-27 18:09:50 +00:00
2018-08-21 12:40:01 +00:00
- name : Remove apache2 default config files (debuntu)
2018-02-07 00:26:57 +00:00
file :
2018-08-21 12:41:02 +00:00
path : "{{ item }}"
2018-02-07 00:26:57 +00:00
state : absent
2018-08-21 12:40:01 +00:00
with_items :
2018-08-21 18:02:56 +00:00
- /etc/apache2/000-default.conf # Not nec on Raspbian. Is this really still needed elsewhere?
2018-08-21 12:40:01 +00:00
- /etc/apache2/sites-enabled/000-default.conf
2017-05-27 23:10:45 +00:00
when : is_debuntu
2017-05-27 18:09:50 +00:00
2018-10-28 01:13:29 +00:00
- name : Create Apache's pid dir /var/run/{{ apache_user }}
2018-02-07 00:26:57 +00:00
file :
path : "/var/run/{{ apache_user }}"
mode : 0755
owner : root
group : root
state : directory
2017-05-27 18:09:50 +00:00
2017-10-27 13:25:51 +00:00
- name : Create admin group
2018-02-07 00:26:57 +00:00
group :
name : admin
state : present
2017-05-27 18:09:50 +00:00
2018-10-28 06:29:10 +00:00
- name : Add user {{ apache_user }} (from variable apache_user) to admin group
2018-02-07 00:26:57 +00:00
user :
name : "{{ apache_user }}"
groups : admin
state : present
createhome : no
2017-05-27 18:09:50 +00:00
2018-10-28 01:13:29 +00:00
- name : Create Apache's log dir /var/log/{{ apache_service }}
2018-02-07 00:26:57 +00:00
file :
path : "/var/log/{{ apache_service }}"
mode : 0755
owner : "{{ apache_user }}"
group : "{{ apache_user }}"
state : directory
2017-05-27 18:09:50 +00:00
2018-10-28 01:13:29 +00:00
- name : Enable systemd service {{ apache_service }}
2018-02-07 00:26:57 +00:00
service :
name : "{{ apache_service }}"
enabled : yes
2017-05-27 18:09:50 +00:00
2018-10-28 06:18:54 +00:00
- name : Create /library/www/html/info directory for http://box/info offline docs
2018-02-07 00:26:57 +00:00
file :
path : "{{ doc_root }}/info"
mode : 0755
owner : "{{ apache_user }}"
group : "{{ apache_user }}"
state : directory
2017-05-27 18:09:50 +00:00
2018-10-28 06:18:54 +00:00
# roles/httpd/templates/iiab-info.conf.j2.deprecated is no longer needed, as
# Apache serves http://box/info directly from above /library/www/html/info
# directly (as generated by /usr/bin/iiab-refresh-wiki-docs)
#
#- name: Remove iiab-info.conf
# file:
# path: "/etc/{{ apache_config_dir }}/iiab-info.conf"
# state: absent
#
#- name: Remove iiab-info.conf symlink (debuntu)
# file:
# path: /etc/apache2/sites-enabled/iiab-info.conf
# state: absent
# when: is_debuntu
2017-05-27 18:09:50 +00:00
2018-09-19 22:47:16 +00:00
# SEE https://github.com/iiab/iiab/issues/1143 as the old roles/osm playbook is rarely used as of late 2018 (if anybody still uses roles/osm, they can overwrite osm.conf using the original osm playbook, or in other ways)
2018-09-19 22:32:49 +00:00
- name : Copy osm.conf for http://box/maps (all OS's)
copy :
src : osm.conf
dest : "/etc/{{ apache_config_dir }}"
owner : root
group : root
mode : 0644
backup : yes
2018-10-28 06:18:54 +00:00
- name : Create osm.conf symlink from sites-enabled to sites-available (debuntu)
2018-09-19 22:32:49 +00:00
file :
src : "/etc/{{ apache_config_dir }}/osm.conf"
2018-10-28 06:18:54 +00:00
path : /etc/apache2/sites-enabled/osm.conf
#path: "/etc/{{ apache_service }}/sites-enabled/osm.conf"
2018-09-19 22:32:49 +00:00
state : link
when : is_debuntu
2017-10-31 03:55:24 +00:00
- include_tasks : html.yml
2017-05-27 18:09:50 +00:00
tags :
- base
2018-07-18 22:18:17 +00:00
# Fixes search @ http://box/modules/es-wikihow - see https://github.com/iiab/iiab/issues/829
2018-07-18 21:41:38 +00:00
- include_tasks : php-stem.yml
tags :
- base
2018-07-19 00:34:57 +00:00
- name : Install /usr/bin/iiab-refresh-wiki-docs (scraper script) to create http://box/info offline documentation (will be run at the end of Stage 4 = roles/4-server-options/tasks/main.yml)
2018-02-07 00:26:57 +00:00
template :
src : refresh-wiki-docs.sh
dest : /usr/bin/iiab-refresh-wiki-docs
mode : 0755
2017-06-09 23:25:56 +00:00
2018-08-21 12:25:15 +00:00
- name : Give apache_user permission to poweroff
2018-02-07 00:26:57 +00:00
template :
src : 020_apache_poweroff.j2
dest : /etc/sudoers.d/020_apache_poweroff
mode : 0755
2018-09-23 23:12:22 +00:00
when : apache_allow_sudo
2017-07-06 16:56:43 +00:00
2018-08-21 12:25:15 +00:00
- name : Remove apache_user permission to poweroff
2018-02-07 00:26:57 +00:00
file :
2018-10-28 06:18:54 +00:00
path : /etc/sudoers.d/020_apache_poweroff
2018-02-07 00:26:57 +00:00
state : absent
2018-09-23 23:12:22 +00:00
when : not apache_allow_sudo