-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.sh
More file actions
43 lines (41 loc) · 1.17 KB
/
install.sh
File metadata and controls
43 lines (41 loc) · 1.17 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
USERNAME=$2
PRIVATE_KEY=$3
EXTRAVARS=$4
case "$1" in
"db")
PYTHONUNBUFFERED=1 \
ANSIBLE_FORCE_COLOR=true \
ANSIBLE_HOST_KEY_CHECKING=false \
ANSIBLE_SSH_ARGS='-o UserKnownHostsFile=/dev/null -o ControlMaster=auto -o ControlPersist=60s' \
ansible-playbook \
--private-key=$PRIVATE_KEY \
--user=$USERNAME \
--connection=ssh \
--limit='dbservers' \
--inventory-file=dbhosts \
--become \
--become-method=sudo \
"$(pwd)/env/install-dbservers.yml"
;;
"web")
PYTHONUNBUFFERED=1 \
ANSIBLE_FORCE_COLOR=true \
ANSIBLE_HOST_KEY_CHECKING=false \
ANSIBLE_SSH_ARGS='-o UserKnownHostsFile=/dev/null -o ControlMaster=auto -o ControlPersist=60s' \
ansible-playbook \
--private-key=$PRIVATE_KEY \
--user=$USERNAME \
--connection=ssh \
--limit='webservers' \
--inventory-file=webhosts \
--become \
--become-method=sudo \
-e "$EXTRAVARS" \
"$(pwd)/env/install-webservers.yml"
;;
"*")
echo "Usage: $NAME {db|web}" >&2
exit 3
;;
esac