forked from kaansoral/adventureland
-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (52 loc) · 1.84 KB
/
setup_servers.yml
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
name: Deploy Infrastructure and Run Ansible
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Terraform
uses: hashicorp/[email protected]
with:
terraform_version: 1.1.0 # You can specify the version you want to use
- name: Initialize Terraform
working-directory: ./cicd/infra
run: terraform init
env:
TF_HTTP_ADDRESS: ${{ secrets.TF_HTTP_ADDRESS }}
TF_HTTP_USERNAME: ${{ secrets.TF_HTTP_USERNAME }}
TF_HTTP_PASSWORD: ${{ secrets.TF_HTTP_PASSWORD }}
- name: Terraform Apply
working-directory: ./cicd/infra
run: terraform apply -auto-approve -input=false
env:
TF_VAR_hcloud_token: ${{ secrets.hcloud_token }}
TF_HTTP_ADDRESS: ${{ secrets.TF_HTTP_ADDRESS }}
TF_HTTP_USERNAME: ${{ secrets.TF_HTTP_USERNAME }}
TF_HTTP_PASSWORD: ${{ secrets.TF_HTTP_PASSWORD }}
# deploy:
# runs-on: ubuntu-latest
# steps:
# - name: Download Inventory Artifact
# uses: actions/download-artifact@v2
# with:
# name: terraform-output # Specify the artifact name you used in the Terraform workflow
# path: inventory # Specify the directory to download the artifact contents
#
# - name: Run Ansible Playbook
# uses: aimerib/ansible-playwright@v2
# with:
# playbook: deploy.yml
# directory: ./
# key: ${{ secrets.SSH_PRIVATE_KEY }}
# inventory: |
# ${{ runner.workspace }}/inventory/your-downloaded-inventory-file
# known_hosts: .known_hosts
# vault_password: ${{ secrets.VAULT_PASSWORD }}
# requirements: galaxy-requirements.yml
# options: |
# --verbose