equal
deleted
inserted
replaced
|
1 #!/usr/bin/env bash |
|
2 |
|
3 SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
|
4 SCRIPTNAME=`basename "$0"` |
|
5 |
|
6 usage() { |
|
7 echo -n "${SCRIPTNAME} [CONFIG] [DB_FILE_PATH] [ORIGIN_URL] |
|
8 |
|
9 Deploy the database <DB_FILE_PATH> using ansible. |
|
10 Replacing the <ORIGIN_URL> by the destination url in the ansible config (rc_wp_home). |
|
11 " |
|
12 } |
|
13 |
|
14 if [[ "$#" -ne 3 ]]; then |
|
15 usage |
|
16 exit 1 |
|
17 fi |
|
18 |
|
19 config=${1} |
|
20 db_file_path=${2} |
|
21 origin_url=${3} |
|
22 |
|
23 case $config in |
|
24 test) configOK=true;; |
|
25 prod) configOK=true;; |
|
26 *) configOK=false;; |
|
27 esac |
|
28 |
|
29 if [[ "$configOK" = false ]]; then |
|
30 usage |
|
31 exit 1 |
|
32 fi |
|
33 |
|
34 pushd "$SCRIPTPATH" |
|
35 |
|
36 ANSIBLE_SSH_PIPELINING=1 ANSIBLE_STDOUT_CALLBACK=debug ansible-playbook -v -i "./hosts/hosts.$config" -l "$config" ./deploy_db.yml --extra-vars "db_file_path='${db_file_path}' origin_url='${origin_url}'" --ask-vault-pass |
|
37 |
|
38 popd |