diff --git a/roles/wordpress/tasks/install.yml b/roles/wordpress/tasks/install.yml index fa794dd3c..3b88d9972 100644 --- a/roles/wordpress/tasks/install.yml +++ b/roles/wordpress/tasks/install.yml @@ -7,9 +7,9 @@ # - "mv /library/wordpress /library/wordpress.old" # - back up WordPress's database then drop it # -# REASON: "keep_newer: yes" below tries to preserves WordPress's self-upgrades +# REASON: "keep_newer: yes" below tries to preserve WordPress's self-upgrades # and security enhancements using timestamps under /library/wordpress, as these -# can arise without warning when WordPress is online, since WordPress ~4.8. +# can arise without warning when WordPress is online, since WordPress ~4.8 - name: Download the latest WordPress software get_url: @@ -47,6 +47,21 @@ mode: 0664 keep_newer: yes +# For schools that use WordPress intensively. WARNING: Enabling this (might) +# cause excess use of RAM or other resources? github.com/iiab/iiab/issues/1147 +- name: Raise php.ini limits in schools that use WordPress intensively + lineinfile: + path: "/etc/php/{{ php_version }}/{{ apache_service }}/php.ini" + regexp: "{{ item.regexp }}" + line: "{{ item.line }}" + when: wordpress_raise_php_limits + with_items: + - { regexp: '^upload_max_filesize', line: 'upload_max_filesize 64M ; default on RPi is 2M' } + - { regexp: '^post_max_size', line: 'post_max_size 128M ; default on RPi is 8M' } + - { regexp: '^memory_limit', line: 'memory_limit 256M ; default on RPi is 128M' } + - { regexp: '^max_execution_time', line: 'max_execution_time 300 ; default on RPi is 30' } + - { regexp: '^max_input_time', line: 'max_input_time 300 ; default on RPi is 60' } + # - name: Rename /library/wordpress* to /library/wordpress # shell: if [ ! -d {{ wp_abs_path }} ]; then mv {{ wp_abs_path }}* {{ wp_abs_path }}; fi @@ -104,7 +119,7 @@ priv: "{{ wp_db_name }}.*:ALL,GRANT" state: present -- name: Copy WordPress config file +- name: Copy wp-config.php template: src: wp-config.php.j2 dest: "{{ wp_abs_path }}/wp-config.php" @@ -112,25 +127,25 @@ group: "{{ apache_user }}" mode: 0660 -- name: Copy WordPress httpd conf file +- name: Copy wordpress.conf to permit http://box{{ wp_url }} template: src: wordpress.conf.j2 dest: "/etc/{{ apache_config_dir }}/wordpress.conf" -- name: Enable httpd conf file if we are disabled (debuntu) +- name: Enable wordpress.conf if wordpress_enabled (debuntu) file: src: /etc/apache2/sites-available/wordpress.conf dest: /etc/apache2/sites-enabled/wordpress.conf state: link when: wordpress_enabled and is_debuntu -- name: Remove httpd conf file if we are disabled (OS's other than debuntu) +- name: Remove wordpress.conf if not wordpress_enabled (debuntu) file: path: /etc/apache2/sites-enabled/wordpress.conf state: absent when: not wordpress_enabled and is_debuntu -- name: Restart Apache, so it picks up the new aliases +- name: Restart Apache to enable/disable http://box{{ wp_url }} service: name: "{{ apache_service }}" state: restarted