From 58e70e65e4c134489657ba4a1ae4c7a4d7bb7578 Mon Sep 17 00:00:00 2001 From: Morris Mukiri Date: Mon, 25 Feb 2019 13:01:19 +0300 Subject: [PATCH] Add variable for cron file name Add a backup cron file filename to be able to use the same role in same server to create multiple cron jobs. Signed-off-by: Morris Mukiri --- README.md | 1 + defaults/main.yml | 1 + tasks/configure.yml | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 06eda0c..3b399f4 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ The role variables and default values. backup_enabled: yes # Enable the role backup_remove: no # Set yes for uninstall the role from target system backup_cron: yes # Setup cron tasks for backup +backup_cron_filename: backup # The cron file name for backup tasks. Use it for multiple backup configs on the same server backup_user: root # Run backups as user backup_group: "{{backup_user}}" diff --git a/defaults/main.yml b/defaults/main.yml index 25a1c05..133e923 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -3,6 +3,7 @@ backup_enabled: yes # Enable the role backup_remove: no # Set yes for uninstall the role from target system backup_cron: yes # Setup cron tasks for backup +backup_cron_filename: backup # The cron file name for backup tasks. Use it for multiple backup configs on the same server backup_user: root # Run backups as user backup_group: "{{backup_user}}" diff --git a/tasks/configure.yml b/tasks/configure.yml index c28918a..dcc175c 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -42,7 +42,7 @@ with_items: "{{backup_profiles}}" - name: backup-configure | Setup cron - template: src=cron.j2 dest=/etc/cron.d/backup owner=root group=root mode=0644 + template: src=cron.j2 dest=/etc/cron.d/{{backup_cron_filename}} owner=root group=root mode=0644 when: backup_cron - name: backup-configure | Create log files