2017-11-29 21:05:36 +00:00
|
|
|
# "Emergency" reinstalls (from /opt/iiab/downloads/wordpress.tar.gz
|
|
|
|
# to /library/wordpress) should also work offline...
|
2017-11-15 16:03:08 +00:00
|
|
|
#
|
2017-11-30 01:25:09 +00:00
|
|
|
# ONLINE OR OFFLINE, IF YOU NEED A CLEAN REINSTALL OF WORDPRESS DURING YOUR
|
2018-07-12 22:13:58 +00:00
|
|
|
# NEXT RUN OF "./runrole wordpress" OR "./iiab-install" PLEASE FIRST DO:
|
2017-11-29 21:05:36 +00:00
|
|
|
#
|
|
|
|
# - "mv /library/wordpress /library/wordpress.old"
|
|
|
|
# - back up WordPress's database then drop it
|
2017-11-15 16:03:08 +00:00
|
|
|
#
|
2018-09-22 15:03:44 +00:00
|
|
|
# REASON: "keep_newer: yes" below tries to preserve WordPress's self-upgrades
|
2017-11-30 01:32:46 +00:00
|
|
|
# and security enhancements using timestamps under /library/wordpress, as these
|
2018-09-22 15:03:44 +00:00
|
|
|
# can arise without warning when WordPress is online, since WordPress ~4.8
|
2017-11-15 16:03:08 +00:00
|
|
|
|
2018-10-31 06:22:41 +00:00
|
|
|
- name: Download {{ wordpress_download_base_url }}/{{ wordpress_src }} to {{ downloads_dir }}
|
2017-11-15 16:03:08 +00:00
|
|
|
get_url:
|
|
|
|
url: "{{ wordpress_download_base_url }}/{{ wordpress_src }}"
|
|
|
|
dest: "{{ downloads_dir }}"
|
2017-12-08 05:49:24 +00:00
|
|
|
timeout: "{{ download_timeout }}"
|
2020-01-11 18:17:50 +00:00
|
|
|
# force: yes
|
|
|
|
# backup: yes
|
2017-09-21 00:13:18 +00:00
|
|
|
register: wp_download_output
|
2019-05-24 22:33:10 +00:00
|
|
|
when: internet_available | bool
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2020-01-12 00:48:50 +00:00
|
|
|
- name: Symlink {{ downloads_dir }}/wordpress.tar.gz -> {{ wp_download_output.dest }}
|
2017-11-15 16:03:08 +00:00
|
|
|
file:
|
|
|
|
src: "{{ wp_download_output.dest }}"
|
2020-01-12 00:48:50 +00:00
|
|
|
path: "{{ downloads_dir }}/wordpress.tar.gz" # /opt/iiab/downloads
|
2017-11-15 16:03:08 +00:00
|
|
|
state: link
|
|
|
|
when: wp_download_output.dest is defined
|
|
|
|
|
2020-01-12 00:48:50 +00:00
|
|
|
- name: Does {{ downloads_dir }}/wordpress.tar.gz link exist?
|
2017-11-15 16:03:08 +00:00
|
|
|
stat:
|
2020-01-12 00:48:50 +00:00
|
|
|
path: "{{ downloads_dir }}/wordpress.tar.gz" # /opt/iiab/downloads
|
2017-11-15 16:03:08 +00:00
|
|
|
register: wp_link
|
|
|
|
|
2020-01-12 00:48:50 +00:00
|
|
|
- name: FAIL (force Ansible to exit) IF {{ downloads_dir }}/wordpress.tar.gz doesn't exist
|
2017-11-15 16:03:08 +00:00
|
|
|
fail:
|
|
|
|
msg: "{{ downloads_dir }}/wordpress.tar.gz is REQUIRED in order to install WordPress."
|
|
|
|
when: not wp_link.stat.exists
|
|
|
|
|
2017-11-15 17:30:53 +00:00
|
|
|
- name: "Unpack /opt/iiab/downloads/wordpress.tar.gz to permanent location /library/wordpress - owner: root, group: {{ apache_user }}, mode: 0664, keep_newer: yes"
|
2017-11-15 16:03:08 +00:00
|
|
|
unarchive:
|
|
|
|
src: "{{ downloads_dir }}/wordpress.tar.gz"
|
|
|
|
dest: "{{ wp_install_path }}"
|
2020-01-12 00:48:50 +00:00
|
|
|
# owner: root
|
2020-01-11 18:17:50 +00:00
|
|
|
group: "{{ apache_user }}" # DO WE REALLY STILL WANT THIS FOR NGINX?
|
|
|
|
mode: '0664'
|
2017-11-15 16:03:08 +00:00
|
|
|
keep_newer: yes
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2017-11-15 22:56:39 +00:00
|
|
|
- name: Make /library/wordpress directories 775 so Apache can traverse and write (most files remain 0664)
|
2017-06-01 02:07:25 +00:00
|
|
|
command: "/usr/bin/find {{ wp_abs_path }} -type d -exec chmod 775 {} +"
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2018-10-31 06:22:41 +00:00
|
|
|
- name: Install {{ wp_abs_path }}/wp-keys.php.BAK
|
2017-12-08 05:49:24 +00:00
|
|
|
copy:
|
|
|
|
src: wp-keys.php.BAK
|
|
|
|
dest: "{{ wp_abs_path }}/wp-keys.php.BAK"
|
2020-01-12 00:48:50 +00:00
|
|
|
# owner: root
|
2020-01-11 18:17:50 +00:00
|
|
|
group: "{{ apache_user }}" # DO WE REALLY STILL WANT THIS FOR NGINX?
|
|
|
|
mode: '0640'
|
2017-05-27 18:09:50 +00:00
|
|
|
|
|
|
|
# Fetch random salts for WordPress config into wp-keys.php file by generating script and running
|
|
|
|
|
2018-10-31 06:22:41 +00:00
|
|
|
- name: Install script /tmp/get-iiab-wp-salts from template
|
2017-12-08 05:49:24 +00:00
|
|
|
template:
|
|
|
|
src: get-iiab-wp-salts.j2
|
|
|
|
dest: /tmp/get-iiab-wp-salts
|
2020-01-12 00:48:50 +00:00
|
|
|
# owner: root
|
|
|
|
# group: root
|
2020-01-11 18:17:50 +00:00
|
|
|
mode: '0700'
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2018-10-31 06:22:41 +00:00
|
|
|
- name: Run /tmp/get-iiab-wp-salts to create /library/wordpress/wp-keys.php
|
2017-06-09 23:25:56 +00:00
|
|
|
command: /tmp/get-iiab-wp-salts
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2018-10-31 06:22:41 +00:00
|
|
|
- name: Remove script /tmp/get-iiab-wp-salts
|
2017-12-08 05:49:24 +00:00
|
|
|
file:
|
|
|
|
path: /tmp/get-iiab-wp-salts
|
|
|
|
state: absent
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2018-10-31 06:22:41 +00:00
|
|
|
- name: Install {{ wp_abs_path }}/wp-config.php
|
2017-12-08 05:49:24 +00:00
|
|
|
template:
|
|
|
|
src: wp-config.php.j2
|
|
|
|
dest: "{{ wp_abs_path }}/wp-config.php"
|
2020-01-12 00:48:50 +00:00
|
|
|
# owner: root
|
2020-01-11 18:17:50 +00:00
|
|
|
group: "{{ apache_user }}" # DO WE REALLY STILL WANT THIS FOR NGINX?
|
|
|
|
mode: '0660'
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2018-10-31 06:22:41 +00:00
|
|
|
- name: Install etc/{{ apache_config_dir }}/wordpress.conf from template, for http://box{{ wp_url }}
|
2017-12-08 05:49:24 +00:00
|
|
|
template:
|
|
|
|
src: wordpress.conf.j2
|
|
|
|
dest: "/etc/{{ apache_config_dir }}/wordpress.conf"
|
2020-01-11 18:17:50 +00:00
|
|
|
when: apache_enabled | bool
|
2019-10-15 23:47:49 +00:00
|
|
|
|
2020-01-12 23:15:33 +00:00
|
|
|
- name: "Add 'wordpress_installed: True' to {{ iiab_state_file }}"
|
2019-09-09 17:14:13 +00:00
|
|
|
lineinfile:
|
2020-01-12 23:15:33 +00:00
|
|
|
dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
|
2019-09-09 17:14:13 +00:00
|
|
|
regexp: '^wordpress_installed'
|
2019-10-07 17:11:21 +00:00
|
|
|
line: 'wordpress_installed: True'
|