borgbase / ansible-role-borgbackup

Ansible role to set up Borg and Borgmatic
MIT License
229 stars 102 forks source link

Missing c flag in cronjob #69

Closed Genygo closed 3 years ago

Genygo commented 3 years ago

If i set borgmatic_config_name and borgmatic_large_repo to false the cronjob is missing the -c flag for the specific config file.

- name: Add cron-job for borgmatic (normal-sized repo)
  block:
    - name: Add cron job for create, check and prune
      cron:
        name: "{{ borgmatic_cron_name }}"
        hour: "{{ borgmatic_cron_hour }}"
        minute: "{{ borgmatic_cron_minute }}"
        user: "root"
        cron_file: "{{ borgmatic_cron_name }}"
        job: "/usr/local/bin/borgmatic"
    - name: Ensure separate check cron job is absent
      cron:
        name: "{{ borgmatic_cron_name }}-check"
        state: absent
  when: not borgmatic_large_repo
m3nu commented 3 years ago

Setting borgmatic_config_name doesn't make much sense and defaults to config.yaml.

But I agree that the normal sized-case doesn't honor the borgmatic_config_name setting, which is an issue.

Here a PR for this. Let me know if this resolves the issue for your use case.