Working Template - tested with music
This commit is contained in:
@@ -52,37 +52,38 @@ jobs:
|
||||
run: terraform apply -auto-approve
|
||||
working-directory: "terraform"
|
||||
|
||||
- name: Install Ansible
|
||||
shell: bash
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ansible rsync
|
||||
#### 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: 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: Run playbook
|
||||
run: |
|
||||
ansible-playbook ansible/playbooks/docker_copy.yml -i ansible/inventory/inventory.yml -u cloud --private-key ~/.ssh/vlans_rsa
|
||||
# - name: Configure Git
|
||||
# run: |
|
||||
# git config user.name "git-bot"
|
||||
# git config user.email "got-bot@text.com"
|
||||
|
||||
- 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: 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
|
||||
|
||||
@@ -9,6 +9,15 @@ on:
|
||||
default: "terraform"
|
||||
type: string
|
||||
|
||||
tfvars_file:
|
||||
description: "Which tfvars file to use"
|
||||
required: true
|
||||
default: "single.tfvars.example"
|
||||
type: choice
|
||||
options:
|
||||
- single.tfvars.example
|
||||
- multi.tfvars.example
|
||||
|
||||
jobs:
|
||||
destroy:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -22,6 +31,12 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check files & Select tfvars
|
||||
shell: bash
|
||||
run: |
|
||||
cp "${{ inputs.tfvars_file || 'single.tfvars.example' }}" terraform.tfvars
|
||||
cat terraform.tfvars
|
||||
|
||||
- name: Setup Terraform
|
||||
uses: hashicorp/setup-terraform@v4
|
||||
|
||||
|
||||
Reference in New Issue
Block a user