forked from atzhit7/arcgis-system-deploy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
buildspec_deploy_provisioning_blue.yaml
56 lines (55 loc) · 2.84 KB
/
buildspec_deploy_provisioning_blue.yaml
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
53
54
55
56
---
version: 0.2
phases:
pre_build:
commands:
- python -m pip install --upgrade pip
- pip install --upgrade botocore boto3 pywinrm awscli
- pip install ansible==5.9.0 ansible-lint
- git clone https://github.com/tfutils/tfenv.git ~/.tfenv
- ln -s ~/.tfenv/bin/* /usr/local/bin
build:
commands:
- echo $DEPLOY_SUBDOMAIN
- echo $DEPLOY_PURPOSE
#########################
- echo "Set for codebuild"
- cd ./envs/dev/app/
- make for-codebuild
#########################
- echo "Run Deploy Blue"
- cd ./blue/
- aws ssm get-parameter --name "/egihssystem/terraform/bluevars" | jq -r .Parameter.Value > ./terraform.tfvars
- tfenv install
- tfenv use
- terraform --version
- terraform init -input=false -no-color
- terraform workspace show
- terraform workspace select $DEPLOY_SUBDOMAIN || terraform workspace new $DEPLOY_SUBDOMAIN
- terraform plan -input=false -no-color -var='deploy_purpose='$DEPLOY_PURPOSE
- terraform apply -input=false -no-color -auto-approve -var='deploy_purpose='$DEPLOY_PURPOSE
- echo "Run Provisioning base deployment"
- cd ../ansible/
- cat ./inventory
- aws ssm get-parameter --name "/arcgissystem/manage/private-web-sg-id" | jq -r .Parameter.Value > ./private_web_group_id
- cat ./private_web_group_id
- aws ssm get-parameter --name "/arcgissystem/manage/private-data-sg-id" | jq -r .Parameter.Value > ./private_data_group_id
- cat ./private_data_group_id
- aws ec2 authorize-security-group-ingress --group-id "$(cat ./private_web_group_id)" --protocol tcp --port 5985 --cidr 0.0.0.0/0
- aws ec2 authorize-security-group-ingress --group-id "$(cat ./private_data_group_id)" --protocol tcp --port 5985 --cidr 0.0.0.0/0
# # - aws ec2 authorize-security-group-ingress --group-id "$(cat ./private_web_group_id)" --protocol tcp --port 5985 --cidr `curl inet-ip.info`/32
# # - aws ec2 authorize-security-group-ingress --group-id "$(cat ./private_data_group_id)" --protocol tcp --port 5985 --cidr `curl inet-ip.info`/32
- ansible arcgisdatastorenode -i ./inventory -m win_ping
- ansible-playbook -i ./inventory ./arcgisportal.yaml
- ansible-playbook -i ./inventory ./arcgisserver.yaml
- ansible-playbook -i ./inventory ./arcgisdatastore.yaml
- ansible-playbook -i ./inventory ./federation.yaml
- echo "congratulations!!"
post_build:
commands:
- echo "Now Finished Privisioning by Ansible"
- echo "close security group"
- echo "$PWD"
- cd ../ansible/
- aws ec2 revoke-security-group-ingress --group-id "$(cat ./private_web_group_id)" --protocol tcp --port 5985 --cidr 0.0.0.0/0
- aws ec2 revoke-security-group-ingress --group-id "$(cat ./private_data_group_id)" --protocol tcp --port 5985 --cidr 0.0.0.0/0