Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

randomized systemd timer delays #36

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ restic::enable_backup: true
restic::enable_forget: true
restic::backup_timer: 'Mon..Sun *:00:00'
restic::forget_timer: Mon..Sun 23:00:00
restic::forget_timer_random_delay: 6h
restic::host: 'host.name'
restic::id: 's3id'
restic::key: 's3key'
Expand Down
90 changes: 51 additions & 39 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
# @param backup_timer
# Default systemd timer for backup see: https://wiki.archlinux.de/title/Systemd/Timers
#
# @param backup_timer_random_delay
# Delay the timer by a random amount of time to avoid multiple hosts running at the same time see: https://www.freedesktop.org/software/systemd/man/latest/systemd.timer.html#RandomizedDelaySec=
#
# @param backup_exit3_success
# Consider restic's exit code 3 as success. https://restic.readthedocs.io/en/latest/040_backup.html#exit-status-codes
#
Expand Down Expand Up @@ -70,6 +73,9 @@
# @param forget_timer
# Default systemd timer for forget see: https://wiki.archlinux.de/title/Systemd/Timers
#
# @param forget_timer_random_delay
# Delay the timer by a random amount of time to avoid multiple hosts running at the same time see: https://www.freedesktop.org/software/systemd/man/latest/systemd.timer.html#RandomizedDelaySec=
#
# @param global_flags
# Default global flags for `restic <flags>`. See `restic --help`
#
Expand Down Expand Up @@ -133,6 +139,9 @@
# @param sftp_user
# The user who connects to the SFTP repository
#
# @param restore_timer_random_delay
# Delay the timer by a random amount of time to avoid multiple hosts running at the same time see: https://www.freedesktop.org/software/systemd/man/latest/systemd.timer.html#RandomizedDelaySec=
#
# @param type
# Default name for the Restic repository. s3, gs, rest and sftp are supported.
#
Expand All @@ -158,45 +167,48 @@
##
## default values for restic::repositories
##
Variant[Array[String[1]],String[1]] $backup_flags = [],
Optional[Restic::Path] $backup_path = undef,
Optional[Variant[Array[String[1]],String[1]]] $backup_pre_cmd = undef,
Optional[Variant[Array[String[1]],String[1]]] $backup_post_cmd = undef,
Optional[String[1]] $backup_timer = undef,
Boolean $backup_exit3_success = false,
Stdlib::Absolutepath $binary = '/usr/bin/restic',
Optional[String] $bucket = undef,
Boolean $enable_backup = true,
Boolean $enable_forget = false,
Boolean $enable_restore = false,
Restic::Forget $forget = {},
Variant[Array[String[1]],String[1]] $forget_flags = [],
Optional[Variant[Array[String[1]],String[1]]] $forget_pre_cmd = undef,
Optional[Variant[Array[String[1]],String[1]]] $forget_post_cmd = undef,
Optional[String[1]] $forget_timer = undef,
Variant[Array[String[1]],String[1]] $global_flags = [],
Optional[Integer[1]] $max_cpus = undef,
Optional[Stdlib::Absolutepath] $gcs_credentials_path = undef,
Optional[Variant[Sensitive[String],String]] $gcs_project_id = undef,
Optional[Variant[Sensitive[String],String]] $gcs_repository = undef,
String $group = 'root',
Optional[Variant[Sensitive[String],String]] $host = undef,
Optional[Variant[Sensitive[String],String]] $id = undef,
Boolean $init_repo = true,
Optional[Variant[Sensitive[String],String]] $key = undef,
Optional[Variant[Sensitive[String],String]] $password = undef,
Boolean $prune = false,
Variant[Array[String[1]],String[1]] $restore_flags = [],
Optional[Stdlib::Absolutepath] $restore_path = undef,
Optional[Variant[Array[String[1]],String[1]]] $restore_pre_cmd = undef,
Optional[Variant[Array[String[1]],String[1]]] $restore_post_cmd = undef,
String[1] $restore_snapshot = 'latest',
Optional[String[1]] $restore_timer = undef,
Optional[Variant[Sensitive[String],String]] $sftp_port = undef,
Optional[Variant[Sensitive[String],String]] $sftp_repository = undef,
Optional[Variant[Sensitive[String],String]] $sftp_user = undef,
Restic::Repository::Type $type = 's3',
String[1] $user = 'root',
Variant[Array[String[1]],String[1]] $backup_flags = [],
Optional[Restic::Path] $backup_path = undef,
Optional[Variant[Array[String[1]],String[1]]] $backup_pre_cmd = undef,
Optional[Variant[Array[String[1]],String[1]]] $backup_post_cmd = undef,
Optional[String[1]] $backup_timer = undef,
Optional[Variant[String[1], Integer]] $backup_timer_random_delay = undef,
Boolean $backup_exit3_success = false,
Stdlib::Absolutepath $binary = '/usr/bin/restic',
Optional[String] $bucket = undef,
Boolean $enable_backup = true,
Boolean $enable_forget = false,
Boolean $enable_restore = false,
Restic::Forget $forget = {},
Variant[Array[String[1]],String[1]] $forget_flags = [],
Optional[Variant[Array[String[1]],String[1]]] $forget_pre_cmd = undef,
Optional[Variant[Array[String[1]],String[1]]] $forget_post_cmd = undef,
Optional[String[1]] $forget_timer = undef,
Optional[Variant[String[1], Integer]] $forget_timer_random_delay = undef,
Variant[Array[String[1]],String[1]] $global_flags = [],
Optional[Integer[1]] $max_cpus = undef,
Optional[Stdlib::Absolutepath] $gcs_credentials_path = undef,
Optional[Variant[Sensitive[String],String]] $gcs_project_id = undef,
Optional[Variant[Sensitive[String],String]] $gcs_repository = undef,
String $group = 'root',
Optional[Variant[Sensitive[String],String]] $host = undef,
Optional[Variant[Sensitive[String],String]] $id = undef,
Boolean $init_repo = true,
Optional[Variant[Sensitive[String],String]] $key = undef,
Optional[Variant[Sensitive[String],String]] $password = undef,
Boolean $prune = false,
Variant[Array[String[1]],String[1]] $restore_flags = [],
Optional[Stdlib::Absolutepath] $restore_path = undef,
Optional[Variant[Array[String[1]],String[1]]] $restore_pre_cmd = undef,
Optional[Variant[Array[String[1]],String[1]]] $restore_post_cmd = undef,
String[1] $restore_snapshot = 'latest',
Optional[String[1]] $restore_timer = undef,
Optional[Variant[String[1], Integer]] $restore_timer_random_delay = undef,
Optional[Variant[Sensitive[String],String]] $sftp_port = undef,
Optional[Variant[Sensitive[String],String]] $sftp_repository = undef,
Optional[Variant[Sensitive[String],String]] $sftp_user = undef,
Restic::Repository::Type $type = 's3',
String[1] $user = 'root',
) {
contain restic::package
contain restic::reload
Expand Down
Loading