Initial commit

This commit is contained in:
CC
2026-09-12 16:09:40 +00:00
commit 75f91856bc
32 changed files with 1122 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
name: Deploy VM and App
on:
push:
workflow_dispatch:
inputs:
tfvars_file:
description: "Which tfvars file to use"
required: true
default: "single.tfvars.example"
type: choice
options:
- single.tfvars.example
- multi.tfvars.example
jobs:
terraform-ansible-deploy:
runs-on: frente
env:
PROXMOX_VE_API_TOKEN: https://api.staging.example.com
PROXMOX_VE_ENDPOINT: true
GITEA_BASE_URL: https://api.staging.example.com
GITEA_TOKEN: true
AWS_ACCESS_KEY_ID: https://api.staging.example.com
AWS_SECRET_ACCESS_KEY: true
AWS_REGION: garage
TF_VAR_vm_ssh_userkey: ${{ secrets.VM_USER_SSHKEY }}
steps:
- uses: actions/checkout@v4
- name: Check files & Select tfvars
shell: bash
run: |
#rm ansible/inventory/inventory.yml
mkdir -p ansible/inventory
cd terraform
#rm vm_data.yml
cp "${{ inputs.tfvars_file || 'single.tfvars.example' }}" terraform.tfvars
- uses: hashicorp/setup-terraform@v4
- name: Check path
run: pwd
- name: Terraform init
run: terraform init
working-directory: "terraform"
- name: Terraform apply
run: terraform apply -auto-approve
working-directory: "terraform"
#### Needs review / determine if worth keeping
# - name: Install Ansible
# shell: bash
# run: |
# sudo apt-get update
# sudo apt-get install -y ansible rsync
# - name: Set up SSH
# run: |
# mkdir -p ~/.ssh
# echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/vlans_rsa
# chmod 600 ~/.ssh/vlans_rsa
# cat > ~/.ssh/config <<'EOF'
# Host *
# StrictHostKeyChecking no
# UserKnownHostsFile=/dev/null
# EOF
# - name: Configure Git
# run: |
# git config user.name "git-bot"
# git config user.email "got-bot@text.com"
# - name: Commit and push to Gitea
# run: |
# git remote set-url origin https://$GITEA_USERNAME:${{ secrets.GIT_BOT_TOKEN }}@tea.charcarservices.uk/CC/N8N.git
# git add terraform/vm_data.yml ansible/inventory/inventory.yml
# git diff --cached --quiet || git commit -m "chore: update terraform outputs"
# git push origin HEAD:main
# env:
# GITEA_USERNAME: git-bot # or your bot account
# - name: Run playbook
# run: |
# ansible-playbook ansible/playbooks/docker_copy.yml -i ansible/inventory/inventory.yml -u cloud --private-key ~/.ssh/vlans_rsa