borgbase / ansible-role-borgbackup

Ansible role to set up Borg and Borgmatic
MIT License
227 stars 99 forks source link

Support to copy config to management server for pruning? #57

Closed stroobl closed 1 year ago

stroobl commented 3 years ago

With my previous Borg backup role (without Borgmatic - it didn't exist at the time we started using Attic), I had a secured management host where I did the pruning for all hosts configured in append only mode. Would you be interested to add a feature to this role that makes it possible to copy the config to such a management host?

I already did some tests and something like this should work:

- name: Copy config to management host (for pruning)
  template:
    src: config.yaml.j2
    dest: "{{ borgmatic_mgmt_host_path }}/{{ inventory_hostname }}.yaml"
    mode: 0600
  remote_user: "{{ borgmatic_mgmt_user }}"
  become: false
  delegate_to: "{{ borgmatic_mgmt_host }}"
  when: borgmatic_mgmt_host is defined
m3nu commented 3 years ago

I like the concept of mgmt hosts and we recommend it in conjunction with append-only repos.

Regarding the snippet: Don't you think this makes the role do too many things at once and it becomes a bit convoluted? Personally, I'd put it in my playbook. But hard to tell in this case.

stroobl commented 3 years ago

I don't think it's possible to access the config.yaml.j2 template included in the role from a post_task in the playbook in an elegant way?