forked from matheusmaais/Terraform_ansible_docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
25 lines (24 loc) · 914 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
#!bin/bash
echo "\n ========================= \n"
echo "\nIniciando Execução do Script \n \n"
echo "Setando Variaveis de ambiente \n"
export ANSIBLE_HOST_KEY_CHECKING=False
echo "\n ========================= \n"
echo "\n Rodando terraform Init"
sleep 1
terraform init
echo "\n ========================= \n"
echo "Rodando terraform Apply"
terraform apply -auto-approve
echo "\n ========================= \n"
echo "Aguardando o servidor ficar pronto para rodar o Ansible"
ansible-playbook ansible_server/provisioning.yml -i ansible_server/hosts
echo "\n =========================== \n\n"
echo "\n Jenkins Passwd inicial é\n"
cat JenkinsPassword
unset IP_SERVIDOR
export IP_SERVIDOR=$(cat ./ip_servidor.txt)
echo "\nAcesso a aplicação: http://$IP_SERVIDOR:3000\n"
echo "Acesso ao Jenkins: http://$IP_SERVIDOR:8080\n"
echo "\n\nPara destruir o ambiente digite: \n terraform destroy"
echo "Script finalizado!"