Exclude specified nodes/VMs from image backups

This commit is contained in:
Râu Cao 2023-07-25 16:38:55 +02:00
parent a85bbc4a3e
commit 9568b7072d
Signed by: raucao
GPG Key ID: 15E65F399D084BA9
3 changed files with 13 additions and 0 deletions

View File

@ -34,6 +34,15 @@
}
}
},
"kosmos_kvm": {
"backup": {
"nodes_excluded": [
"garage-2", "garage-3", "garage-4",
"postgres-5",
"rsk-mainnet-2", "rsk-testnet-3"
]
}
},
"kosmos-mastodon": {
"domain": "kosmos.social",
"s3_endpoint": "http://localhost:3900",

View File

@ -8,3 +8,5 @@ node.default["kosmos_kvm"]["host"]["qemu_base_image"] = {
# A systemd.timer OnCalendar config value
node.default["kosmos_kvm"]["backup"]["schedule"] = "daily"
# Node/VM names excluded from backups
node.default["kosmos_kvm"]["backup"]["nodes_excluded"] = []

View File

@ -54,6 +54,8 @@ end
vm_domains = search(:node, "role:kvm_guest").map{|n| n["hostname"] } \
& `virsh list --name`.strip.chomp.split("\n")
vm_domains.reject! { |d| node["kosmos_kvm"]["backup"]["nodes_excluded"].include?(d) }
template "/root/backups/backup_all_vms.sh" do
source "backup_all_vms.sh.erb"
mode '0750'