Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit c07303d5 authored by Thomas MICHEL's avatar Thomas MICHEL
Browse files

Merge branch '52-fix-borgmatic-deprecated-conf' into 'main'

Resolve "fix: borgmatic deprecated conf"

Closes #52

See merge request lydra/ansible-bootstrap!50
parents 29f36403 7a0c1d21
No related branches found
No related tags found
No related merge requests found
Pipeline #61632 failed
--- ---
backup_enabled: true backup_enabled: true
backup_sourcedir: "/data/" backup_sourcedir: "/data/"
# Variables for BorgBackup # Variables for BorgBackup
borg_source_directories: borg_source_directories:
- "{{ backup_sourcedir }}" - "{{ backup_sourcedir }}"
borg_version: "1.2.7" borg_version: "1.4.0"
borgmatic_version: "1.8.8" borgmatic_version: "1.9.14"
borgmatic_relocated_repo_access_is_ok: true borgmatic_relocated_repo_access_is_ok: true
borgmatic_cron_lines: borgmatic_cron_lines:
- '0 2 * * * root borgmatic -c /etc/borgmatic/borg_local_repo' - '0 2 * * * root borgmatic -c /etc/borgmatic/borg_local_repo'
......
---
vault_borg_remote_repository_port: 1995
...@@ -10,3 +10,4 @@ borg_retention_policy: ...@@ -10,3 +10,4 @@ borg_retention_policy:
keep_weekly: "12" keep_weekly: "12"
keep_monthly: "12" keep_monthly: "12"
borgmatic_cron_name: "borgmatic_remote_backup" borgmatic_cron_name: "borgmatic_remote_backup"
borg_ssh_command: "ssh -p {{ vault_borg_remote_repository_port }} -o StrictHostKeychecking=no -i {{ borg_ssh_keys_dest }}"
...@@ -24,17 +24,13 @@ ...@@ -24,17 +24,13 @@
- name: Run local backup post tasks - name: Run local backup post tasks
when: backup_enabled | default(true) | bool when: backup_enabled | default(true) | bool
block: block:
- name: Remove lines with prefix - name: Change borgmatic default config for custom one
ansible.builtin.lineinfile: ansible.builtin.copy:
path: "/etc/borgmatic/{{ borgmatic_config_name }}" src: "templates/borgmatic_custom_config.yml.j2"
state: absent dest: "/etc/borgmatic/{{ borgmatic_config_name }}"
regexp: '^prefix: .*' owner: root
group: root
- name: Change archive name in "/etc/borgmatic/{{ borgmatic_config_name }}" mode: '0600'
ansible.builtin.lineinfile:
path: "/etc/borgmatic/{{ borgmatic_config_name }}"
regexp: 'archive_name_format:'
line: " archive_name_format: {{ borg_archive_name_format }}"
state: present state: present
- name: Initialize a new Borg local repository - name: Initialize a new Borg local repository
......
...@@ -39,25 +39,13 @@ ...@@ -39,25 +39,13 @@
- name: Run remote backup post tasks - name: Run remote backup post tasks
when: backup_enabled | default(true) | bool when: backup_enabled | default(true) | bool
block: block:
- name: Change SSH command in "/etc/borgmatic/{{ borgmatic_config_name }}" - name: Change borgmatic default config for custom one
ansible.builtin.lineinfile: ansible.builtin.template:
path: "/etc/borgmatic/{{ borgmatic_config_name }}" src: "templates/borgmatic_custom_config.yml.j2"
regexp: "# ssh_command: ssh -i ~/.ssh/id_ed25519" dest: "/etc/borgmatic/{{ borgmatic_config_name }}"
line: " ssh_command: ssh -p {{ vault_borg_remote_repository_port }} -o StrictHostKeychecking=no -i {{ borg_ssh_keys_dest }}" owner: root
state: present group: root
mode: '0600'
- name: Remove lines with prefix (to be deprecated)
ansible.builtin.lineinfile:
path: "/etc/borgmatic/{{ borgmatic_config_name }}"
state: absent
regexp: '^prefix: .*'
- name: Change archive name in "/etc/borgmatic/{{ borgmatic_config_name }}"
ansible.builtin.lineinfile:
path: "/etc/borgmatic/{{ borgmatic_config_name }}"
regexp: "archive_name_format:"
line: " archive_name_format: {{ borg_archive_name_format }}"
state: present
- name: Create borg command in /usr/local/bin - name: Create borg command in /usr/local/bin
ansible.builtin.copy: ansible.builtin.copy:
......
#jinja2: lstrip_blocks: "True", trim_blocks: "True"
---
# Managed by Ansible, please don't edit manually
# Full config: https://torsion.org/borgmatic/docs/reference/config.yaml
# Source directories to backup
source_directories:
{% for directory in borg_source_directories %}
- {{ directory }}
{% endfor %}
# Repository configuration
repositories:
{% if borg_repository is string %}
- path: {{ borg_repository }}
label: main
{% else %}
{% for item in borg_repository %}
- path: {{ item.repository }}
label: {{ item.label }}
{% endfor %}
{% endif %}
# Store atime into archive. Defaults to true in Borg < 1.2, false in
# Borg 1.2+.
atime: true
# Store ctime into archive. Defaults to true.
ctime: true
# Exclude patterns (if any)
{% if borg_exclude_patterns is defined %}
exclude_patterns:
{% for pattern in borg_exclude_patterns %}
- {{ pattern }}
{% endfor %}
{% endif %}
# Exclude if present (now as a list)
exclude_if_present:
- .nobackup
# Exclude directories that contain a CACHEDIR.TAG file. See
# http://www.brynosaurus.com/cachedir/spec.html for details. Defaults
# to false.
exclude_caches: true
# Encryption settings
encryption_passphrase: "{{ borg_encryption_passphrase }}"
# Compression settings
compression: {{ borg_compression | default('auto,zstd') }}
# SSH command (if configured)
{% if borg_ssh_command is defined %}
ssh_command: {{ borg_ssh_command }}
{% endif %}
# Umask to be used for borg create.
umask: 0077
# Maximum seconds to wait for acquiring a repository lock.
lock_wait: {{ borg_lock_wait_time | default(5) }}
# Name of the archive. Borg placeholders can be used. See the output of
# "borg help placeholders" for details. Default is
# "{hostname}-{now:%Y-%m-%dT%H:%M:%S.%f}". If you specify this option, you must
# also specify a prefix in the retention section to avoid accidental pruning of
# archives with a different archive name format. And you should also specify a
# prefix in the consistency section as well.
archive_name_format: {{ borg_archive_name_format }}
# Bypass Borg error about a repository that has been moved.
relocated_repo_access_is_ok: true
# Retention settings
{% if borg_retention_policy.keep_daily is defined %}
keep_daily: {{ borg_retention_policy.keep_daily }}
{% endif %}
{% if borg_retention_policy.keep_weekly is defined %}
keep_weekly: {{ borg_retention_policy.keep_weekly }}
{% endif %}
{% if borg_retention_policy.keep_monthly is defined %}
keep_monthly: {{ borg_retention_policy.keep_monthly }}
{% endif %}
# Consistency checks
checks:
- name: repository
frequency: 4 weeks
- name: archives
frequency: 6 weeks
check_last: {{ borgmatic_check_last | default(3) }}
# Hooks configuration (if any)
{% if borgmatic_hooks is defined %}
{% for hook_type, hook_list in borgmatic_hooks.items() %}
{{ hook_type }}:
{% for hook in hook_list %}
- {{ hook }}
{% endfor %}
{% endfor %}
{% endif %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment