diff --git a/REFERENCE.md b/REFERENCE.md
index 2075b4e..008194d 100644
--- a/REFERENCE.md
+++ b/REFERENCE.md
@@ -37,6 +37,32 @@ Configure GitLab backups
include profile_gitlab::backup
```
+#### Parameters
+
+The following parameters are available in the `profile_gitlab::backup` class:
+
+* [`paths`](#-profile_gitlab--backup--paths)
+* [`prehook_commands`](#-profile_gitlab--backup--prehook_commands)
+* [`posthook_commands`](#-profile_gitlab--backup--posthook_commands)
+
+##### `paths`
+
+Data type: `Array[String]`
+
+List of paths (locations to files or directories) to be backed up.
+
+##### `prehook_commands`
+
+Data type: `Array[String]`
+
+List of commands to run before the paths are backed up.
+
+##### `posthook_commands`
+
+Data type: `Array[String]`
+
+List of commands to run after the paths are backed up.
+
### `profile_gitlab::firewall`
Open GitLab ports in the firewall
diff --git a/data/common.yaml b/data/common.yaml
index 8b70ea5..5837e49 100644
--- a/data/common.yaml
+++ b/data/common.yaml
@@ -1,4 +1,12 @@
---
+profile_gitlab::backup::paths:
+ - "/etc/gitlab"
+ - "/var/opt/gitlab/backups"
+profile_gitlab::backup::prehook_commands:
+ - "/opt/gitlab/bin/gitlab-backup create CRON=1"
+profile_gitlab::backup::posthook_commands:
+ - "find /etc/gitlab/config_backup \\( -name '*.tar' \\) -mtime +30 -type f -exec rm -rf {} \\;"
+ - "find /var/opt/gitlab/backups \\( -name '*.tar' \\) -mtime +2 -type f -exec rm -rf {} \\;"
profile_gitlab::firewall::http_allowed_subnets:
"public": "0.0.0.0/0"
#"NCSA private": "172.24.0.0/13"
diff --git a/manifests/backup.pp b/manifests/backup.pp
index ef157d8..f3942bd 100644
--- a/manifests/backup.pp
+++ b/manifests/backup.pp
@@ -1,32 +1,28 @@
# @summary Configure GitLab backups
#
+# @param paths
+# List of paths (locations to files or directories) to be backed up.
+#
+# @param prehook_commands
+# List of commands to run before the paths are backed up.
+#
+# @param posthook_commands
+# List of commands to run after the paths are backed up.
+#
# @example
# include profile_gitlab::backup
-class profile_gitlab::backup {
+class profile_gitlab::backup (
+ Array[String] $paths,
+ Array[String] $prehook_commands,
+ Array[String] $posthook_commands,
+) {
if ( lookup('profile_backup::client::enabled') ) {
include profile_backup::client
profile_backup::client::add_job { 'profile_gitlab':
- paths => [
- '/etc/gitlab',
- '/var/opt/gitlab/backups',
- ],
- prehook_commands => [
- '/opt/gitlab/bin/gitlab-backup create CRON=1',
- ],
- posthook_commands => [
- "find /etc/gitlab/config_backup \\( -name '*.tar' \\) -mtime +30 -type f -exec rm -rf {} \\;",
- "find /var/opt/gitlab/backups \\( -name '*.tar' \\) -mtime +2 -type f -exec rm -rf {} \\;",
- ],
- }
-
- # REMOVE OLD BACKUP CRONS FROM <= v0.1.1 OF THIS MODULE
- # THIS LOGIC CAN BE REMOVED IN FUTURE VERSIONS OF THIS MODULE
- cron { 'GITLAB DAILY BACKUPS':
- ensure => 'absent',
- }
- cron { 'GITLAB CLEANUP BACKUPS':
- ensure => 'absent',
+ paths => $paths,
+ prehook_commands => $prehook_commands,
+ posthook_commands => $posthook_commands,
}
}
}