Refactor Ansible actions to improve host inventory handling

This commit is contained in:
2024-10-06 18:06:37 +02:00
parent cc30dd522a
commit 748b8ff7e2
19 changed files with 174 additions and 24 deletions
@@ -0,0 +1,34 @@
name: Terraform IAC Apply
on:
schedule:
- cron: "0 1 * * 0"
push:
branches:
- main
paths:
- "terraform/aws-iac/**"
jobs:
terraform-apply:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup environment
uses: ./.github/actions/setup-env
- name: Setup Terraform environment
uses: ./.github/actions/setup-terraform-env
- name: Terraform Init
env:
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
run: |
cd terraform/aws-iac
sectool exec terraform init
sectool exec terraform apply --auto-approve
@@ -0,0 +1,37 @@
name: Terraform AWS IAC Validate on Pull Request
on:
pull_request:
branches:
- main
paths:
- "terraform/aws-iac/**"
types:
- opened
- synchronize
- reopened
jobs:
terraform-validate:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup environment
uses: ./.github/actions/setup-env
- name: Setup Terraform environment
uses: ./.github/actions/setup-terraform-env
- name: Terraform Init and Validate
env:
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
run: |
cd terraform/iac
sectool exec terraform init
sectool exec terraform validate
sectool exec terraform fmt -check
sectool exec terraform plan
@@ -44,6 +44,7 @@ jobs:
- name: Terraform Init and Validate
env:
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
SYSTEM_ID: ${{ steps.get-host-info.outputs.system-id }}
run: |
cd terraform/iac
export TF_VAR_system_id=$SYSTEM_ID