forked from Uninett/research-lab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_dev.sh
executable file
·52 lines (45 loc) · 2.55 KB
/
run_dev.sh
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
44
45
46
47
48
49
50
51
52
#!/bin/bash
set -e
cd "$(dirname "${BASH_SOURCE[0]}")"
# Check if required programs are installed.
if ! [ -x "$(command -v virtualenv)" ]; then
echo 'Error: virtualenv is not installed.' >&2
echo 'Try: "sudo pip install virtualenv" or "sudo yum install python-virtualenv" or "sudo apt-get install virtualenv" to install it.' >&2
exit 1
fi
pushd "terraform/deployments/$1"
if [ ! -f local.tfvars ]; then
echo "You must create local.tfvars in the deployment dir" >&2
popd
exit 1
fi
terraform get
# This first (serial) run of the security group rules are needed due to strange
# behaviour where only some of the rules are there after the initial run unless
# the are processed sequentially.
#
# See:
# https://github.com/hashicorp/terraform/issues/7519
#
if [ "$1" = "uh-iaas" -o "$1" = "safespring" ]; then
terraform apply -var-file local.tfvars -parallelism=1 \
-target module.securitygroups.openstack_networking_secgroup_rule_v2.rule_ssh_access_ipv4 \
-target module.securitygroups.openstack_networking_secgroup_rule_v2.rule_kube_lb_http_ipv4 \
-target module.securitygroups.openstack_networking_secgroup_rule_v2.rule_kube_lb_https_ipv4 \
-target module.securitygroups.openstack_networking_secgroup_rule_v2.rule_kube_master_ipv4
elif [ "$1" = "all" ]; then
terraform apply -var-file local.tfvars -parallelism=1 \
-target module.uhiaas_cluster.module.securitygroups.openstack_networking_secgroup_rule_v2.rule_ssh_access_ipv4 \
-target module.uhiaas_cluster.module.securitygroups.openstack_networking_secgroup_rule_v2.rule_kube_lb_http_ipv4 \
-target module.uhiaas_cluster.module.securitygroups.openstack_networking_secgroup_rule_v2.rule_kube_lb_https_ipv4 \
-target module.uhiaas_cluster.module.securitygroups.openstack_networking_secgroup_rule_v2.rule_kube_master_ipv4 \
-target module.safespring_cluster.module.securitygroups.openstack_networking_secgroup_rule_v2.rule_ssh_access_ipv4 \
-target module.safespring_cluster.module.securitygroups.openstack_networking_secgroup_rule_v2.rule_kube_lb_http_ipv4 \
-target module.safespring_cluster.module.securitygroups.openstack_networking_secgroup_rule_v2.rule_kube_lb_https_ipv4 \
-target module.safespring_cluster.module.securitygroups.openstack_networking_secgroup_rule_v2.rule_kube_master_ipv4
fi
# Now, do the rest in parallell as normal
terraform apply -var-file local.tfvars
terraform output inventory > ../../../ansible/inventory
popd
./ansible/apply.sh