change source dir for rsync #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Infrastructure and Run Ansible | |
on: | |
push: | |
branches: | |
- main | |
- ansible-test | |
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 }} | |
setup: | |
runs-on: ubuntu-latest | |
needs: deploy | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Run Ansible Playbook | |
uses: dawidd6/action-ansible-playbook@v2 | |
with: | |
playbook: ./playbooks.yml | |
directory: ./cicd/setup | |
key: ${{ secrets.HETZNER_PRIVATE_KEY }} | |
options: | | |
--inventory inventory.yml |