-
Notifications
You must be signed in to change notification settings - Fork 0
/
migrate-opendata-ch.yml
27 lines (23 loc) · 1.24 KB
/
migrate-opendata-ch.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
---
- hosts: webservers
vars_files:
- vault.yml
- vars.yml
tasks:
- name: get Wordpress content
command: rsync --times --recursive --compress --owner --group --usermap=*:www-data --groupmap=*:www-data --exclude 'cache' --exclude 'plugins' --exclude 'themes' [email protected]:/var/www/wordpress/wp-content/ "{{ opendata_ch_root }}/wp-content"
- name: get MySQL database dump
command: rsync --times --compress [email protected]:/var/backups/mysql_2016-06-29.sql.gz /home/www-data/opendata_ch.sql.gz
- name: import MySQL database
shell: zcat /home/www-data/opendata_ch.sql.gz | mysql --user="{{ opendata_ch_database_user }}" --password="{{ opendata_ch_database_password }}" "{{ opendata_ch_database_name }}"
- name: change URLs in database
command: mysql --user="{{ opendata_ch_database_user }}" --password="{{ opendata_ch_database_password }}" "{{ opendata_ch_database_name }}" --execute="UPDATE {{ item }} SET option_value = CONCAT(option_value, '/wordpress') WHERE option_name = 'siteurl';"
with_items:
- wp_options
- wp_2_options
- wp_3_options
- wp_4_options
- wp_5_options
- wp_6_options
- wp_8_options
- wp_11_options