Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.
/ VyosConfig Public archive

A repository to manage and maintain my VyOS instance

License

Notifications You must be signed in to change notification settings

binaryn3xus/VyosConfig

Repository files navigation

Important

Notice of archival (2024-05-1) Due to the way VyOS has been handling their community recently I have decided to step away from VyOS as my router platform and have archived this repository.




Static Badge GitHub code size in bytes GitHub language count GitHub last commit (branch)

This repo reflects my ongoing journey in configuring my home network with VyOS. While it may not be flawless, I hope it serves as a helpful resource for fellow HomeLab enthusiasts. Feel free to explore, learn, and contribute, as we all learn together!

Requirements

Getting Started

Install Git on VyOS

sudo apt update
sudo apt install git

Installing SOPS on Vyos

This README assumes that you already have a SOPS AGE key

  1. Download the SOPS installer
wget https://github.com/getsops/sops/releases/download/v3.7.3/sops_3.7.3_amd64.deb
  1. Install SOPS
sudo apt install sops_3.7.3_amd64.deb
  1. Add your SOPS key to /config/secrets/age.key

Clone your configuration project

Clone your configuration to the root folder /config

Example:

📁 /config            # Vyos defined as code
├─📁 config-parts     # Vyos commands split into seperate files
├─📁 containers       # Container configurations
└─📁 scripts          # Vyos scripts
└─🗒️ .gitignore       # gitignore file
└─🗒️ ..etc..          # All other files

NOTE: Handling .gitignore Files

  • Include a .gitignore file in all folders and set it to ignore everything by default: /*
  • To add specific files or folders to the repository, allowlist them with ! before the file or folder name. For example: !/apply-config.sh or !config-parts/ for files and folders (respectively).

This is to prevent accidentially committing unintented/sensitive files from being added to your repository.


Using the apply-config.sh

Dry-Run

config
cd /config
run ./apply-config.sh

Actual Run

Notice the -c argument

config
cd /config
run ./apply-config.sh -c

Options/Flags

Bash Shell Options Default Value Description
-c Will NOT commit automatically Including the -c flag will commit and save the configuration
-x Will NOT remove orphaned images Including the -x flag will remove the orphan container images that are no longer in use. Note: This only runs when -c is provided as well.

Scripts

Built-in Scripts

The vyos-preconfig-bootup.script and vyos-postconfig-bootup.script scripts are officially supported script files that run either before or after the VyOS configuration during the boot process.

The /config/scripts/vyos-preconfig-bootup.script script is called on boot before the VyOS configuration during boot process.

The /config/scripts/vyos-postconfig-bootup.script script is called on boot after the VyOS configuration during boot process.

You can find more information on this in the Executing Configuration Scripts for more information.

Custom Scripts

As for the custom-config-backup.sh, this is a custom script that we will execute via a cronjob within VyOS. In order to do this, we must add a couple lines of code to our configuration.

In your system.sh, you can add the following lines:

set system task-scheduler task backup-config crontab-spec '30 0 * * *'
set system task-scheduler task backup-config executable path '/config/scripts/custom-config-backup.sh'

This snippet tells vyos to execute the script every day at 00:30.

Releases

No releases published

Packages

No packages published

Languages