Update vyos.yml #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "VyOS Ansible Configuration Apply" | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'ansible/roles/vyos/**' | |
- 'ansible/host_vars/vyos.yml' | |
- 'ansible/playbooks/vyos.yml' | |
workflow_dispatch: | |
jobs: | |
ansible: | |
name: "Ansible" | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/lab-astr0rack-net/ansible:latest | |
options: --cap-add=NET_ADMIN --cap-add=NET_RAW --dns=1.1.1.1 --dns=100.100.100.100 --add-host vyos.lab.astr0rack.net:192.168.55.3 | |
volumes: | |
- /var/lib:/var/lib | |
- /dev/net/tun:/dev/net/tun | |
defaults: | |
run: | |
working-directory: ansible | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Setup ssh key | |
env: | |
SSH_KEY: ${{ secrets.ANSIBLE_SSH_KEY }} | |
run: | | |
mkdir -p ~/.ssh | |
chmod 700 ~/.ssh | |
echo "$SSH_KEY" > ~/.ssh/id_ed25519 | |
chmod 400 ~/.ssh/id_ed25519 | |
- name: Tailscale | |
uses: tailscale/github-action@v1 | |
id: ts-login | |
with: | |
authkey: ${{ secrets.TAILSCALE_AUTHKEY }} | |
- name: Ping vyos | |
run: ansible --ssh-extra-args '"-o StrictHostKeyChecking=accept-new"' -i inventory.yml -m ping vyos | |
- name: Run the vyos playbook | |
env: | |
ANSIBLE_BECOME_PASSWORD: ${{ secrets.ANSIBLE_BECOME_PASSWORD }} | |
VY_LAB_DNS_KEY: ${{ secrets.VY_LAB_DNS_KEY }} | |
VY_DISCORD_WEBHOOK: ${{ secrets.VY_DISCORD_WEBHOOK }} | |
VY_TAILSCALE_AUTH_KEY: ${{ secrets.VY_TAILSCALE_AUTH_KEY }} | |
VY_USER_PASSWORD_HASH: ${{ secrets.VY_USER_PASSWORD_HASH }} | |
run: ansible-playbook playbooks/vyos.yml --tags all,env --extra-vars "ansible_become_password=$ANSIBLE_BECOME_PASSWORD" | |
- name: Logout of Tailscale | |
if: steps.ts-login.conclusion == 'success' | |
id: ts-logout | |
run: sudo tailscale logout | |
- name: Notify discord | |
uses: up9cloud/[email protected] | |
if: cancelled() == false | |
env: | |
GITHUB_JOB_STATUS: ${{ job.status }} | |
DISCORD_WEBHOOK_URL: ${{ secrets.LAB_DISCORD_WEBHOOK }} |