-
Notifications
You must be signed in to change notification settings - Fork 7
/
run.sh
60 lines (42 loc) · 981 Bytes
/
run.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
#NAME: run.sh
#VERSION: 1.3
#DESCRIPTION: Cria uma stack automatizada IaC(Terraform+Ansible)
#DATE OF CREATION: 17/01/2021
#DEVELOPED BY: Emerson Araujo da Silva
#E-MAIL: araujo.emerson28@gmail.com
#LICENSE: GPLv3
echo "Welcome to IaC Adventure"
while : ; do
echo "[ 1 ] Create EC2 on AWS"
echo "[ 2 ] Delete EC2"
echo "[ 3 ] Install Wordpress by Ansible"
echo "[ 4 ] Exit"
read op
case $op in
1) Create_EC2
echo "TERRAFORM INIT"
cd terraform/ ; terraform init
echo "TERRAFORM VALIDATE"
echo ""
terraform validate
echo "CREATING AWS INFRA"
echo ""
terraform apply -auto-approve
;;
2) Delete_EC2
echo "DELETING INFRA ON AWS"
echo ""
cd terraform/ ; terraform destroy -auto-approve
;;
3) Install_Wordpress
echo "INSTALLING AND CONFIGURING WORDPRESS"
echo ""
cd .. ; ansible-playbook ansible/wordpress_main.yml -i terraform/inventory
;;
4) Exit
echo "Bye"
exit
;;
*)echo "Usage: {1|2|3|4}"
esac
done