From f4d636625340f90558db6b9ad2d49eedbb13a4ae Mon Sep 17 00:00:00 2001 From: phil Date: Sun, 9 Apr 2023 09:25:16 +0200 Subject: [PATCH] Add bash completion and labels to repositories --- tasks/borg.yml | 7 ++++++- templates/config.yaml.j2 | 7 ++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tasks/borg.yml b/tasks/borg.yml index 7002806..0e0d0e2 100644 --- a/tasks/borg.yml +++ b/tasks/borg.yml @@ -5,6 +5,11 @@ dest: "/etc/borgmatic/{{ borgmatic_config_name }}" 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" ansible.builtin.cron: name: "{{ borgmatic_timer_cron_name }}" @@ -28,7 +33,7 @@ - name: "Borg | Export repo key" 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 }}" - name: "Borg | Save repo key to localhost" diff --git a/templates/config.yaml.j2 b/templates/config.yaml.j2 index dc7b485..bb54824 100644 --- a/templates/config.yaml.j2 +++ b/templates/config.yaml.j2 @@ -17,13 +17,10 @@ location: # Stay in same file system (do not cross mount points). one_file_system: {{ borg_one_file_system }} repositories: -{% if borg_repository is iterable and (borg_repository is not string and borg_repository is not mapping) %} {% for repo in borg_repository %} - - {{ repo }} + - path: {{ repo.path }} + label: {{ repo.label }} {% endfor %} -{% elif borg_repository is defined and borg_repository is string %} - - {{ borg_repository }} -{% endif %} # Store atime into archive. atime: {{ borgmatic_store_atime }}