-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbootstrap
executable file
·31 lines (24 loc) · 1 KB
/
bootstrap
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
#!/bin/bash
# Runs bootstrapping playbooks against all hosts.
if [ $# -lt 2 ]; then
echo
echo "Runs the bootstrap script against all the nodes in the specified group."
echo "Usage: ./bootstrap DC ANSIBLE_GROUP [USER] [SHOULD_SUDO] [SET_HOSTNAME] [CREATE_BASE_USER] [FORMAT_VOLUMES]"
exit -1
fi
DIR=$(git rev-parse --show-toplevel)
source ${DIR}/utils/spinedc
source ${DIR}/env/bin/activate
export ANSIBLE_GROUP="${1}"
export ANSIBLE_USER="${2-ansibler}"
export ANSIBLE_SHOULD_SUDO="${3-True}"
export ANSIBLE_SHOULD_SET_HOSTNAME="${4-True}"
export ANSIBLE_SHOULD_CREATE_BASE_USER="${5-False}"
export ANSIBLE_SHOULD_FORMAT_VOLUMES="${6-False}"
export ANSIBLE_HOSTNAME="${7}"
export ANSIBLE_FORMAT_VOLUMES="${8}"
# Disables host key checking to support headless provisioning.
export ANSIBLE_HOST_KEY_CHECKING=False
# Purges any local EC2 cache to ensure that new nodes are detected.
export PURGE_EC2_CACHE="true"
ansible-playbook --vault-password-file ~/.vault -e @vault/creds.yml -i ./inventory/ec2 bootstrap.yml