Move vyos config to its own directory, build workflow tools for deploying configs, encrypt entire vyos config file until a better approach can be built
This commit is contained in:
parent
8f578aed76
commit
152403cc55
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -1,4 +1,5 @@
|
||||
secrets.env filter=sops diff=sops
|
||||
*.secrets filter=sops diff=sops
|
||||
*.token filter=sops diff=sops
|
||||
*.passwd filter=sops diff=sops
|
||||
*.passwd filter=sops diff=sops
|
||||
config.boot filter=sops diff=sops
|
58
homelab/vyos/config.boot
Normal file
58
homelab/vyos/config.boot
Normal file
File diff suppressed because one or more lines are too long
5
homelab/vyos/get_config.sh
Normal file
5
homelab/vyos/get_config.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/vbash
|
||||
|
||||
source /opt/vyatta/etc/functions/script-template
|
||||
|
||||
show
|
9
homelab/vyos/load_config.sh
Normal file
9
homelab/vyos/load_config.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#!/bin/vbash
|
||||
|
||||
source /opt/vyatta/etc/functions/script-template
|
||||
|
||||
configure
|
||||
load /home/vyos/config.boot
|
||||
|
||||
echo "Running commit && exit"
|
||||
commit && exit || exit discard
|
8
homelab/vyos/save_config.sh
Normal file
8
homelab/vyos/save_config.sh
Normal file
@ -0,0 +1,8 @@
|
||||
#!/bin/vbash
|
||||
|
||||
source /opt/vyatta/etc/functions/script-template
|
||||
|
||||
configure
|
||||
|
||||
|
||||
save || exit discard
|
47
homelab/vyos/vyos.sh
Executable file
47
homelab/vyos/vyos.sh
Executable file
@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
# Returns saved config file
|
||||
function get_config_saved () {
|
||||
ssh vyos@192.168.1.1 'cat /config/config.boot'
|
||||
}
|
||||
|
||||
# Returns active config file
|
||||
function get_config_active () {
|
||||
scp -q ./get_config.sh vyos@192.168.1.1:/home/vyos/get_config.sh
|
||||
ssh vyos@192.168.1.1 'chmod +x /home/vyos/get_config.sh; /home/vyos/get_config.sh; rm /home/vyos/get_config.sh'
|
||||
}
|
||||
|
||||
# Push local ./config.boot to remote /home/vyos/config.boot
|
||||
function post_config () {
|
||||
scp -q ./config.boot vyos@192.168.1.1:/home/vyos/config.boot
|
||||
}
|
||||
|
||||
function load_config () {
|
||||
scp -q ./load_config.sh vyos@192.168.1.1:/home/vyos/load_config.sh
|
||||
ssh vyos@192.168.1.1 'chmod +x /home/vyos/load_config.sh; /home/vyos/load_config.sh; rm /home/vyos/load_config.sh'
|
||||
}
|
||||
|
||||
function save_config () {
|
||||
scp -q ./save_config.sh vyos@192.168.1.1:/home/vyos/save_config.sh
|
||||
ssh vyos@192.168.1.1 'chmod +x /home/vyos/save_config.sh; /home/vyos/save_config.sh; rm /home/vyos/save_config.sh'
|
||||
}
|
||||
|
||||
function pull () {
|
||||
get_config_saved > config.boot
|
||||
}
|
||||
|
||||
function push () {
|
||||
post_config
|
||||
load_config
|
||||
save_config
|
||||
}
|
||||
|
||||
function edit () {
|
||||
get_config_saved > $SCRIPT_DIR/config.boot
|
||||
vim $SCRIPT_DIR/config.boot
|
||||
push
|
||||
}
|
||||
|
||||
"$1"
|
Loading…
Reference in New Issue
Block a user