homelab-server/.gitea/workflows/deploy.yml

44 lines
1.2 KiB
YAML

name: Homelab Deployment Pipeline
on:
push:
branches:
- main
jobs:
deploy-dns:
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install ansible
run: |
apt-get update
apt-get install -y python3-pip python3-setuptools
pip3 install ansible
- name: Set up SSH private key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" | base64 -d > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
echo -e "Host *\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
- name: Verify SSH Key Format
run: |
echo "File size: $(wc -c < ~/.ssh/id_ed25519) bytes"
echo "First line: $(head -n 1 ~/.ssh/id_ed25519)"
echo "Last line: $(tail -n 1 ~/.ssh/id_ed25519)"
- name: Set up vault password
run: |
echo "${{ secrets.VAULT_PASSWORD }}" > ansible/vault_pass
chmod 600 ansible/vault_pass
- name: Execute DNS playbook
run: |
cd ansible
ansible-playbook configure_dns.yml -i inventory.ini --vault-password-file vault_pass