forked from wvchallenges/opseng-challenge-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aws-app.sh
executable file
·67 lines (36 loc) · 1.42 KB
/
aws-app.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
#### Wave Ops Challenge
####
####
#set -o errexit
#set -o pipefail
virtualenv -p python2.7 waveansible
source waveansible/bin/activate
pip -q install ansible
pip -q install boto
ansible-vault decrypt env/secrets.yml --ask-vault-pass
source env/secrets.yml
echo "Starting AWS setup ...."
ansible-playbook --tag aws playbook.yml
new_instance_ip=$(aws ec2 describe-instances --filters Name=tag:Name,Values=wsoyinka-waveapp --output text --query 'Reservations[*].Instances[*].PublicIpAddress')
## Forcefully bootstrap 16.04 LTS ami
ssh -i ./wsoyinka-opseng-challenge-key.pem -o StrictHostKeyChecking=no ubuntu@$new_instance_ip "sudo apt-get -qq -y update && sudo dpkg --configure -a"
ssh -i ./wsoyinka-opseng-challenge-key.pem -o StrictHostKeyChecking=no ubuntu@$new_instance_ip "sudo apt-get -qq -y install python2.7"
ssh -i ./wsoyinka-opseng-challenge-key.pem -o StrictHostKeyChecking=no ubuntu@$new_instance_ip "sudo ln -s /usr/bin/python2.7 /usr/bin/python"
ansible-playbook --tag common,nginx,deploy playbook.yml
ansible-vault encrypt env/secrets.yml --ask-vault-pass
echo ""
echo ""
clear
echo ""
echo ""
echo "The Web-App can be reached at:"
echo ""
echo "http://$new_instance_ip "
echo ""
echo " Wave Cares About Your Financial Records/Data. PCI-DSS compliant version of this high security application is here :-) "
echo ""
echo "https://$new_instance_ip"
echo ""
echo ""
echo ""