2024-10-25 14:44:38 -07:00
|
|
|
name: Deploy VyOS config.boot to Wizard
|
2024-09-06 13:55:30 -07:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2024-10-24 15:35:10 -07:00
|
|
|
branches: [ main ]
|
|
|
|
paths: [ 'homelab/vyos/config.boot' ]
|
2024-09-06 13:55:30 -07:00
|
|
|
|
|
|
|
jobs:
|
2024-10-25 14:44:38 -07:00
|
|
|
deploy:
|
2024-10-24 16:29:41 -07:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: homelab/vyos
|
2024-09-06 13:55:30 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-10-24 15:46:48 -07:00
|
|
|
- name: Checkout Jafner.net repo
|
|
|
|
uses: actions/checkout@v4
|
2024-10-25 00:29:29 -07:00
|
|
|
- name: Check network connectivity to host
|
|
|
|
run: |
|
2024-10-25 12:06:04 -07:00
|
|
|
sudo apt-get update &&\
|
|
|
|
sudo apt-get install -y iputils-ping
|
2024-10-25 12:08:20 -07:00
|
|
|
ping -c 1 -t 5 -q 192.168.1.1
|
2024-10-24 23:39:51 -07:00
|
|
|
- name: Configure SSH
|
2024-10-24 15:50:10 -07:00
|
|
|
run: |
|
2024-10-24 16:35:40 -07:00
|
|
|
echo -e "${{ secrets.RUNNER_SSH_PRIVATEKEY }}" > /tmp/key
|
2024-10-24 23:47:43 -07:00
|
|
|
chmod 600 /tmp/key
|
2024-10-24 16:42:13 -07:00
|
|
|
ssh-keygen -y -f /tmp/key > /tmp/key.pub
|
2024-10-25 00:03:15 -07:00
|
|
|
mkdir -p ~/.ssh && touch ~/.ssh/known_hosts && chmod 600 ~/.ssh/known_hosts
|
|
|
|
ssh-keyscan -t ed25519 192.168.1.1 >> ~/.ssh/known_hosts
|
2024-10-24 23:47:43 -07:00
|
|
|
- name: Connect to VyOS
|
2024-10-24 16:29:41 -07:00
|
|
|
run: |
|
2024-10-25 12:41:25 -07:00
|
|
|
ssh -i /tmp/key vyos@192.168.1.1 'whoami'
|
2024-10-25 13:27:57 -07:00
|
|
|
- name: Install SOPS
|
|
|
|
run: |
|
|
|
|
curl -o sops -L https://github.com/getsops/sops/releases/download/v3.9.1/sops-v3.9.1.linux.amd64
|
|
|
|
chmod +x sops; mv sops /usr/local/bin/sops
|
|
|
|
sops --version
|
|
|
|
- name: Decrypt config.boot
|
|
|
|
run: |
|
|
|
|
echo -e "$(ssh -i /tmp/key vyos@192.168.1.1 'cat /config/wizard.host.key')\n${{ secrets.AGE_DEPLOY_KEY }}" > /tmp/combined.key
|
|
|
|
export SOPS_AGE_KEY_FILE=/tmp/combined.key
|
|
|
|
sops decrypt -i --input-type json config.boot 2>/dev/null && echo "Decrypted config.boot"
|
|
|
|
- name: Push config to VyOS
|
2024-10-25 13:29:09 -07:00
|
|
|
run: |
|
2024-10-25 13:27:57 -07:00
|
|
|
SSH_CMD="ssh -i /tmp/key" SCP_CMD="scp -i /tmp/key -q" ./vyos.sh push
|