Skip to content

Commit

Permalink
complete
Browse files Browse the repository at this point in the history
  • Loading branch information
box-genius committed Jul 5, 2024
1 parent 7e00544 commit 7300527
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ jobs:
run: terraform init
working-directory: Terraform_IaC

- name: Aplicar Terraform
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: terraform apply -auto-approve -var "aws_access_key=${{ secrets.AWS_ACCESS_KEY_ID }}" -var "aws_secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY }}"
working-directory: Terraform_IaC

- name: Instalar Docker nas Instâncias
run: |
for ip in ${{ env.instance_public_ips }}; do
ssh -o "StrictHostKeyChecking=no" -i /home/runner/.ssh/id_rsa ubuntu@$ip "sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - && sudo add-apt-repository 'deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable' && sudo apt-get update && sudo apt-get install -y docker-ce && sudo usermod -aG docker ubuntu && sudo systemctl enable docker && sudo systemctl start docker && docker --version && echo Docker instalado em $ip || echo Docker não instalado em $ip"
done
# - name: Destruir Terraform
# - name: Aplicar Terraform
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# run: terraform destroy -auto-approve -var "aws_access_key=${{ secrets.AWS_ACCESS_KEY_ID }}" -var "aws_secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY }}"
# run: terraform apply -auto-approve -var "aws_access_key=${{ secrets.AWS_ACCESS_KEY_ID }}" -var "aws_secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY }}"
# working-directory: Terraform_IaC

# - name: Instalar Docker nas Instâncias
# run: |
# for ip in ${{ env.instance_public_ips }}; do
# ssh -o "StrictHostKeyChecking=no" -i /home/runner/.ssh/id_rsa ubuntu@$ip "sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - && sudo add-apt-repository 'deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable' && sudo apt-get update && sudo apt-get install -y docker-ce && sudo usermod -aG docker ubuntu && sudo systemctl enable docker && sudo systemctl start docker && docker --version && echo Docker instalado em $ip || echo Docker não instalado em $ip"
# done

- name: Destruir Terraform
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: terraform destroy -auto-approve -var "aws_access_key=${{ secrets.AWS_ACCESS_KEY_ID }}" -var "aws_secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY }}"
working-directory: Terraform_IaC

0 comments on commit 7300527

Please sign in to comment.