From 2fcc8cff770dae14dc0618df00cd371bc7d6556f Mon Sep 17 00:00:00 2001 From: MichaelFisher1997 Date: Sat, 28 Feb 2026 22:43:26 +0000 Subject: [PATCH] fix: Ansible fetches outputs directly from Terraform state instead of artifacts --- .gitea/workflows/deploy.yml | 38 +++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 5fe9af4..369a81c 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -120,11 +120,35 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Download Terraform Outputs - uses: actions/download-artifact@v3 + - name: Setup Terraform + uses: hashicorp/setup-terraform@v3 with: - name: terraform-outputs - path: outputs/ + terraform_version: ${{ env.TF_VERSION }} + + - name: Setup SSH Keys + run: | + mkdir -p ~/.ssh + echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 + chmod 600 ~/.ssh/id_ed25519 + echo "${{ secrets.SSH_PUBLIC_KEY }}" > ~/.ssh/id_ed25519.pub + chmod 644 ~/.ssh/id_ed25519.pub + + - name: Terraform Init + working-directory: terraform + run: | + terraform init \ + -backend-config="endpoint=${{ secrets.S3_ENDPOINT }}" \ + -backend-config="bucket=${{ secrets.S3_BUCKET }}" \ + -backend-config="region=auto" \ + -backend-config="access_key=${{ secrets.S3_ACCESS_KEY }}" \ + -backend-config="secret_key=${{ secrets.S3_SECRET_KEY }}" \ + -backend-config="skip_requesting_account_id=true" + + - name: Get Terraform Outputs + working-directory: terraform + run: | + mkdir -p ../outputs + terraform output -json > ../outputs/terraform_outputs.json - name: Setup Python uses: actions/setup-python@v5 @@ -138,12 +162,6 @@ jobs: - name: Install Ansible Collections run: ansible-galaxy collection install -r ansible/requirements.yml - - name: Setup SSH Key - run: | - mkdir -p ~/.ssh - echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 - - name: Generate Ansible Inventory working-directory: ansible run: python3 generate_inventory.py