mirror of
				https://github.com/borgbase/ansible-role-borgbackup.git
				synced 2025-11-04 01:19:32 +01:00 
			
		
		
		
	Make cron fully times configureable. By @em0lar
This commit is contained in:
		
							parent
							
								
									10521fe838
								
							
						
					
					
						commit
						51e89d6e24
					
				@ -71,6 +71,12 @@ $ git clone https://github.com/borgbase/ansible-role-borgbackup.git roles/borgba
 | 
			
		||||
- `borg_encryption_passcommand`: The standard output of this command is used to unlock the encryption key.
 | 
			
		||||
- `borg_retention_policy`: Retention policy for how many backups to keep in each category (daily, weekly, monthly, etc).
 | 
			
		||||
- `ssh_key_file`: Path to a private ssh key file (default is `.ssh/id_ed25519`). It generates a ed25519 key if the file doesn't exist yet.
 | 
			
		||||
- `borgmatic_cron_hour`: Hour when regular create and prune cron job will run. Defaults to `{{ 6 | random }}`
 | 
			
		||||
- `borgmatic_cron_minute`: Minute when regular create and prune cron job will run. Defaults to  `{{ 59 | random }}`
 | 
			
		||||
- `borgmatic_cron_checks_day`: Day when cron job for infrequent checks will run. Defaults to `{{ 28 | random }}`
 | 
			
		||||
- `borgmatic_cron_checks_hour`: Hour when cron job for infrequent checks will run. Defaults to `{{ range(7, 24) | random }}`
 | 
			
		||||
- `borgmatic_cron_checks_minute`: Minute when cron job for infrequent checks will run. Defaults to  `{{ 59 | random }}`
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Optional Arguments for [BorgBase.com](https://www.borgbase.com) repository auto creation
 | 
			
		||||
This role can also set up a new repository on BorgBase, using the arguments below. Thanks to [Philipp Rintz](https://github.com/p-rintz) for contribution this feature.
 | 
			
		||||
 | 
			
		||||
@ -27,3 +27,8 @@ bb_quota_size: 0
 | 
			
		||||
bb_alertdays: 0
 | 
			
		||||
bb_repo_name: "{{ inventory_hostname }}"
 | 
			
		||||
bb_sshkey: "{{ root_user['ssh_public_key'] }}"
 | 
			
		||||
borgmatic_cron_hour: "{{ 6 | random }}"
 | 
			
		||||
borgmatic_cron_minute: "{{ 59 | random }}"
 | 
			
		||||
borgmatic_cron_checks_day: "{{ 28 | random }}"
 | 
			
		||||
borgmatic_cron_checks_hour: "{{ range(7, 24) | random }}"
 | 
			
		||||
borgmatic_cron_checks_minute: "{{ 59 | random }}"
 | 
			
		||||
 | 
			
		||||
@ -80,17 +80,17 @@
 | 
			
		||||
    - name: Add cron job for regular create and prune
 | 
			
		||||
      cron:
 | 
			
		||||
        name: "borgmatic"
 | 
			
		||||
        hour: "{{ 6 |random }}"
 | 
			
		||||
        minute: "{{ 59 |random }}"
 | 
			
		||||
        hour: "{{ borgmatic_cron_hour }}"
 | 
			
		||||
        minute: "{{ borgmatic_cron_minute }}"
 | 
			
		||||
        user: "root"
 | 
			
		||||
        cron_file: borgmatic
 | 
			
		||||
        job: "/usr/local/bin/borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }} --create --prune"
 | 
			
		||||
    - name: Add cron job for infrequent checks
 | 
			
		||||
      cron:
 | 
			
		||||
        name: "borgmatic-check"
 | 
			
		||||
        day: "{{ 28 | random }}"
 | 
			
		||||
        hour: "{{ range(7, 24) | random }}"
 | 
			
		||||
        minute: "{{ 59 | random }}"
 | 
			
		||||
        day: "{{ borgmatic_cron_checks_day }}"
 | 
			
		||||
        hour: "{{ borgmatic_cron_checks_hour }}"
 | 
			
		||||
        minute: "{{ borgmatic_cron_checks_minute }}"
 | 
			
		||||
        user: "root"
 | 
			
		||||
        cron_file: borgmatic
 | 
			
		||||
        job: "/usr/local/bin/borgmatic -c /etc/borgmatic/{{ borgmatic_config_name }} --check"
 | 
			
		||||
@ -102,8 +102,8 @@
 | 
			
		||||
    - name: Add cron job for create, check and prune
 | 
			
		||||
      cron:
 | 
			
		||||
        name: "borgmatic"
 | 
			
		||||
        hour: "{{ 6 | random }}"
 | 
			
		||||
        minute: "{{ 59 | random }}"
 | 
			
		||||
        hour: "{{ borgmatic_cron_hour }}"
 | 
			
		||||
        minute: "{{ borgmatic_cron_minute }}"
 | 
			
		||||
        user: "root"
 | 
			
		||||
        cron_file: borgmatic
 | 
			
		||||
        job: "/usr/local/bin/borgmatic"
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user