39 lines
1.1 KiB
YAML
39 lines
1.1 KiB
YAML
name: SSH and echo to file
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
paths: [ 'homelab/vyos/config.boot' ]
|
|
|
|
jobs:
|
|
ssh:
|
|
defaults:
|
|
run:
|
|
working-directory: homelab/vyos
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Jafner.net repo
|
|
uses: actions/checkout@v4
|
|
# - name: Check network connectivity to host
|
|
# run: ping -c 1 -t 1 -q 192.168.1.1
|
|
- name: Configure SSH
|
|
run: |
|
|
echo -e "${{ secrets.RUNNER_SSH_PRIVATEKEY }}" > /tmp/key
|
|
chmod 600 /tmp/key
|
|
ssh-keygen -y -f /tmp/key > /tmp/key.pub
|
|
mkdir -p ~/.ssh && touch ~/.ssh/known_hosts && chmod 600 ~/.ssh/known_hosts
|
|
ssh-keyscan -t ed25519 192.168.1.1 >> ~/.ssh/known_hosts
|
|
- name: Connect to VyOS
|
|
run: |
|
|
ssh -vv -i /tmp/key -p 22 vyos@192.168.1.1 'whoami'
|
|
|
|
# - name: SSH into host
|
|
# uses: appleboy/ssh-action@v1.1.0
|
|
# with:
|
|
# host: 192.168.1.1
|
|
# username: vyos
|
|
# key: ${{ secrets.RUNNER_SSH_PRIVATEKEY }}
|
|
# debug: true
|
|
# script: |
|
|
# echo "$(date)" >> ~/hello.txt
|