Add bash completion and labels to repositories

This commit is contained in:
phil 2023-04-09 09:25:16 +02:00
parent 72555d15c4
commit f4d6366253
2 changed files with 8 additions and 6 deletions

View file

@ -5,6 +5,11 @@
dest: "/etc/borgmatic/{{ borgmatic_config_name }}" dest: "/etc/borgmatic/{{ borgmatic_config_name }}"
mode: "0600" mode: "0600"
- name: "Borg | Install borgmatic bach completions"
ansible.builtin.command:
cmd: "borgmatic --bash-completion > /usr/share/bash-completion/completions/borgmatic"
creates: /usr/share/bash-completion/completions/borgmatic
- name: "Borg | Add borgmatic cron job" - name: "Borg | Add borgmatic cron job"
ansible.builtin.cron: ansible.builtin.cron:
name: "{{ borgmatic_timer_cron_name }}" name: "{{ borgmatic_timer_cron_name }}"
@ -28,7 +33,7 @@
- name: "Borg | Export repo key" - name: "Borg | Export repo key"
ansible.builtin.command: ansible.builtin.command:
cmd: "borg key export {{ item }} {{ borg_key_export_path }}/{{ item | replace('ssh://', '') | replace('@', '') | replace('.', '_') | replace('/', '') }}" cmd: "borg key export {{ item.path }} {{ item.label }}"
loop: "{{ borg_repository }}" loop: "{{ borg_repository }}"
- name: "Borg | Save repo key to localhost" - name: "Borg | Save repo key to localhost"

View file

@ -17,13 +17,10 @@ location:
# Stay in same file system (do not cross mount points). # Stay in same file system (do not cross mount points).
one_file_system: {{ borg_one_file_system }} one_file_system: {{ borg_one_file_system }}
repositories: repositories:
{% if borg_repository is iterable and (borg_repository is not string and borg_repository is not mapping) %}
{% for repo in borg_repository %} {% for repo in borg_repository %}
- {{ repo }} - path: {{ repo.path }}
label: {{ repo.label }}
{% endfor %} {% endfor %}
{% elif borg_repository is defined and borg_repository is string %}
- {{ borg_repository }}
{% endif %}
# Store atime into archive. # Store atime into archive.
atime: {{ borgmatic_store_atime }} atime: {{ borgmatic_store_atime }}