From b7f1c55279758914c7eb4aaa752556f5921a3938 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Tue, 9 Jan 2024 09:54:38 -0500 Subject: [PATCH] Update and add default vars for autobackup --- group_vars/default/pvc.yml | 16 ++++++++-------- roles/pvc/defaults/main.yml | 29 ++++++++++++++++++++++++++++- roles/pvc/templates/pvc/pvc.conf.j2 | 8 ++++---- 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/group_vars/default/pvc.yml b/group_vars/default/pvc.yml index c82009c..f48c50a 100644 --- a/group_vars/default/pvc.yml +++ b/group_vars/default/pvc.yml @@ -211,15 +211,15 @@ pvc_autobackup: # conflicts should those clusters share VM names. It is optional unless this matches your situation. # > The path "/tmp/backups" is usually recommended for remote mounting # > NOTE: If you specify it, the suffix must begin with a '/', but is relative to the root path! - backup_root_path: "/tmp/backups" - backup_root_suffix: "/cluster1" + root_path: "/tmp/backups" + root_suffix: "/mycluster" # Set the VM tag(s) which will be selected for autobackup # > Autobackup selects VMs based on their tags. If a VM has a tag present in this list, it will be # selected for autobackup at runtime; if not it will be ignored. # > Usually, the tag "autobackup" here is sufficient; the administrator should then add this tag # to any VM(s) they want to use autobackups. However, any tag may be specified to keep the tag list # cleaner and more focused, should the administrator choose to. - backup_tags: + tags: - autobackup # Autobackup scheduling schedule: @@ -265,20 +265,20 @@ pvc_autobackup: # These Debian packages will be automatically installed if automatic mounting is enabled packages: # This example installs nfs-common, required for NFS mounts - #- nfs-common + # - nfs-common # These commands are executed at the start of the backup run and should mount a filesystem or otherwise # prepare the system for the backups mount_cmds: # This example shows an NFS mount leveraging the backup_root_path variable - #- "/usr/sbin/mount.nfs -o nfsvers=3 10.0.0.10:/backups {backup_root_path}" + # - "/usr/sbin/mount.nfs -o nfsvers=3 10.0.0.10:/backups {backup_root_path}" # This example shows an SSHFS mount leveraging the backup_root_path variable - #- "/usr/bin/sshfs user@hostname:/path {backup_root_path} -o default_permissions -o sshfs_sync -o IdentityFile=/path/to/id_rsa" + # - "/usr/bin/sshfs user@hostname:/path {backup_root_path} -o default_permissions -o sshfs_sync -o IdentityFile=/path/to/id_rsa" # These commands are executed at the end of the backup run and should unmount a filesystem unmount_cmds: # This example shows a generic umount leveraging the backup_root_path variable - #- "/usr/bin/umount {backup_root_path}" + # - "/usr/bin/umount {backup_root_path}" # This example shows an fusermount3 unmount (e.g. for SSHFS) leveraging the backup_root_path variable - #- "/usr/bin/fusermount3 -u {backup_root_path}" + # - "/usr/bin/fusermount3 -u {backup_root_path}" # Configuration file networks # > Taken from base.yml's configuration; DO NOT MODIFY THIS SECTION. diff --git a/roles/pvc/defaults/main.yml b/roles/pvc/defaults/main.yml index 06a9244..dcbfb6c 100644 --- a/roles/pvc/defaults/main.yml +++ b/roles/pvc/defaults/main.yml @@ -59,7 +59,34 @@ pvc_api_database_password: "PVCprovPassw0rd" # # This slice includes all OSD processes # # At least 1 core per OSD should be assigned to this slice. -# Coordinators +# VM Autobackup +# This is uncommented but disabled so this is not installed by default; enable it in your per-cluster configs +# Autobackup allows the exporting of VM backups automatically to an external disk target. +# These values are default; ensure you modify them in your own group_vars to match your system! +pvc_autobackup: + enabled: no + root_path: /tmp/backups + root_suffix: /mycluster + tags: + - autobackup + schedule: + normal_time: "Tue..Sun *-*-* 0:0:00" + forced_full_time: "Mon *-*-* 0:0:00" + full_interval: 7 + full_retention: 2 + auto_mount: + enabled: no + packages: + # Example: Install nfs-common for NFS mounts + # - nfs-common + mount_cmds: + # Example: Mount an NFSv3 path from 10.0.0.10:/backups to {backup_root_path} + # - "/usr/sbin/mount.nfs -o nfsvers=3 10.0.0.10:/backups {backup_root_path}" + unmount_cmds: + # Example: Unmount the {backup_root_path} + # - "/usr/bin/umount {backup_root_path}" + +# Coordinators & Nodes list pvc_nodes: - hostname: "pvc1" # The full ansible inventory hostname of the node is_coordinator: yes # If the node is a coordinator or not diff --git a/roles/pvc/templates/pvc/pvc.conf.j2 b/roles/pvc/templates/pvc/pvc.conf.j2 index 8b3d190..04ff610 100644 --- a/roles/pvc/templates/pvc/pvc.conf.j2 +++ b/roles/pvc/templates/pvc/pvc.conf.j2 @@ -163,11 +163,11 @@ api: private_key: "{{ pvc_api_ssl_key_path if pvc_api_ssl_key_path is defined and pvc_api_ssl_cert_path else '/etc/pvc/api-key.pem' }}" autobackup: -{% if pvc_autobackup is defined and pvc_autobackup %} - backup_root_path: {{ pvc_autobackup.backup_root_path }} - backup_root_suffix: {{ pvc_autobackup.backup_root_suffix }} +{% if pvc_autobackup is defined and pvc_autobackup.enabled is defined and pvc_autobackup.enabled %} + backup_root_path: {{ pvc_autobackup.root_path }} + backup_root_suffix: {{ pvc_autobackup.root_suffix }} backup_tags: -{% for tag in pvc_autobackup.backup_tags %} +{% for tag in pvc_autobackup.tags %} - {{ tag }} {% endfor %} backup_schedule: