fix some ansible-lint errors
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
---
|
||||
borg_version: "1.4.0"
|
||||
borgmatic_version: "1.4.0"
|
||||
glibc_version: "2.36"
|
||||
pipx_version: "1.7.1"
|
||||
borg_binary_url: "https://github.com/borgbackup/borg/releases/download/{{ borg_version }}/borg-linux-glibc{{ glibc_version | replace('.', '') }}.tgz"
|
||||
borgmatic_binary_url: "https://github.com/borgbackup/borg/releases/download/{{ borgmatic_version }}/borg-linux-glibc{{ glibc_version | replace('.', '') }}.tgz"
|
||||
borgmatic_pipx_bin_dir: "/opt/borgmatic/bin"
|
||||
borgmatic_schedule_oncalendar: "daily"
|
||||
push_pubkey: true
|
||||
ssh_key_path: "/root/borgmatic/id_ed25519"
|
||||
borg_compression: "lz4"
|
||||
borg_keep_hourly: 0
|
||||
borg_keep_daily: 3
|
||||
borg_keep_weekly: 3
|
||||
borg_keep_monthly: 1
|
||||
borg_keep_yearly: 0
|
||||
borg_uptime_kuma:
|
||||
borg_loki:
|
||||
borgmatic_compression: "lz4"
|
||||
borgmatic_keep_hourly: 0
|
||||
borgmatic_keep_daily: 3
|
||||
borgmatic_keep_weekly: 3
|
||||
borgmatic_keep_monthly: 1
|
||||
borgmatic_keep_yearly: 0
|
||||
borgmatic_uptime_kuma:
|
||||
borgmatic_loki:
|
||||
# todo: ansible-lint errors
|
||||
@@ -10,8 +10,8 @@ galaxy_info:
|
||||
|
||||
platforms:
|
||||
- name: "Ubuntu"
|
||||
versions: [ "focal", "jammy", "noble" ]
|
||||
versions: ["focal", "jammy", "noble"]
|
||||
|
||||
galaxy_tags: [ ]
|
||||
galaxy_tags: []
|
||||
|
||||
dependencies: []
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
state: started
|
||||
|
||||
roles:
|
||||
- role: genlab.borgmatic
|
||||
borg_source_directories:
|
||||
- role: genlab.common.borgmatic
|
||||
borgmatic_source_directories:
|
||||
- "/tmp/data"
|
||||
borg_repo_path: "ssh://borg@localhost/./test-repo"
|
||||
borg_repo_label: "test-repo"
|
||||
borg_encryption_passphrase: "secret"
|
||||
borgmatic_repo_path: "ssh://borg@localhost/./test-repo"
|
||||
borgmatic_repo_label: "test-repo"
|
||||
borgmatic_encryption_passphrase: "secret"
|
||||
repo_server_inventory_hostname: ubuntu # in production this should be an Ansible inventory hostname
|
||||
repo_server_user: borg
|
||||
|
||||
@@ -11,18 +11,18 @@
|
||||
- name: "Include default vars"
|
||||
ansible.builtin.include_vars:
|
||||
dir: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/defaults/"
|
||||
extensions: [ 'yml' ]
|
||||
extensions: ['yml']
|
||||
|
||||
- name: "Check if Borg is installed"
|
||||
changed_when: false
|
||||
register: borg_installed_version
|
||||
register: borgmatic_installed_version
|
||||
ansible.builtin.command: "/usr/bin/borg --version"
|
||||
|
||||
- name: "Check Borg version"
|
||||
ansible.builtin.assert:
|
||||
that: borg_installed_version.stdout.find(borg_version)
|
||||
success_msg: "borg version {{ borg_version }} is installed and working"
|
||||
fail_msg: "borg version {{ borg_version }} is not installed or not working correctly"
|
||||
that: borgmatic_installed_version.stdout.find(borgmatic_version)
|
||||
success_msg: "borg version {{ borgmatic_version }} is installed and working"
|
||||
fail_msg: "borg version {{ borgmatic_version }} is not installed or not working correctly"
|
||||
|
||||
- name: "Check if Borgmatic is installed"
|
||||
changed_when: false
|
||||
@@ -31,18 +31,18 @@
|
||||
cmd: "/usr/bin/borgmatic --version"
|
||||
|
||||
- name: "Check that the test repo was created"
|
||||
register: test_repo_readme
|
||||
failed_when: test_repo_readme.stat.exists is false
|
||||
register: borgmatic_test_repo_readme
|
||||
failed_when: borgmatic_test_repo_readme.stat.exists is false
|
||||
ansible.builtin.stat:
|
||||
path: "{{ repo_path }}"
|
||||
|
||||
- name: "Check that the systemd timer for Borgmatic is up and running"
|
||||
register: timer
|
||||
register: borgmatic_timer
|
||||
ansible.builtin.systemd:
|
||||
name: borgmatic.timer
|
||||
|
||||
- name: "Assert that the timer is running"
|
||||
ansible.builtin.assert:
|
||||
that: timer.status.ActiveState == "active"
|
||||
that: borgmatic_timer.status.ActiveState == "active"
|
||||
success_msg: "Timer is running"
|
||||
fail_msg: "Unexpected timer state: '{{ timer.status.ActiveState }}'"
|
||||
fail_msg: "Unexpected timer state: '{{ borgmatic_timer.status.ActiveState }}'"
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
- name: "Compose basic configuration for Borgmatic"
|
||||
ansible.builtin.set_fact:
|
||||
borgmatic_composite_config:
|
||||
source_directories: "{{ borg_source_directories }}"
|
||||
source_directories: "{{ borgmatic_source_directories }}"
|
||||
repositories:
|
||||
- path: "{{ borg_repo_path }}"
|
||||
label: "{{ borg_repo_label }}"
|
||||
encryption_passphrase: "{{ borg_encryption_passphrase }}"
|
||||
compression: "{{ borg_compression }}"
|
||||
- path: "{{ borgmatic_repo_path }}"
|
||||
label: "{{ borgmatic_repo_label }}"
|
||||
encryption_passphrase: "{{ borgmatic_encryption_passphrase }}"
|
||||
compression: "{{ borgmatic_compression }}"
|
||||
# CLI output configuration
|
||||
list_details: true
|
||||
statistics: true
|
||||
@@ -17,18 +17,18 @@
|
||||
syslog_verbosity: 1
|
||||
monitoring_verbosity: 1
|
||||
# backup depth
|
||||
keep_hourly: "{{ borg_keep_hourly }}"
|
||||
keep_daily: "{{ borg_keep_daily }}"
|
||||
keep_weekly: "{{ borg_keep_weekly }}"
|
||||
keep_monthly: "{{ borg_keep_monthly }}"
|
||||
keep_yearly: "{{ borg_keep_yearly }}"
|
||||
keep_hourly: "{{ borgmatic_keep_hourly }}"
|
||||
keep_daily: "{{ borgmatic_keep_daily }}"
|
||||
keep_weekly: "{{ borgmatic_keep_weekly }}"
|
||||
keep_monthly: "{{ borgmatic_keep_monthly }}"
|
||||
keep_yearly: "{{ borgmatic_keep_yearly }}"
|
||||
|
||||
- name: "Add Uptime Kuma configuration"
|
||||
when: borg_uptime_kuma
|
||||
when: borgmatic_uptime_kuma
|
||||
ansible.builtin.set_fact:
|
||||
borgmatic_composite_config: "{{ borgmatic_composite_config | combine({'uptime_kuma': borg_uptime_kuma}) }}"
|
||||
borgmatic_composite_config: "{{ borgmatic_composite_config | combine({'uptime_kuma': borgmatic_uptime_kuma}) }}"
|
||||
|
||||
- name: "Add Loki configuration"
|
||||
when: borg_loki
|
||||
when: borgmatic_loki
|
||||
ansible.builtin.set_fact:
|
||||
borgmatic_composite_config: "{{ borgmatic_composite_config | combine({'loki': borg_loki}) }}"
|
||||
borgmatic_composite_config: "{{ borgmatic_composite_config | combine({'loki': borgmatic_loki}) }}"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
mode: "0700"
|
||||
|
||||
- name: "Generate an ed25519 SSH key pair with 100 KDF rounds"
|
||||
register: ssh_key_pair
|
||||
register: borgmatic_ssh_key_pair
|
||||
community.crypto.openssh_keypair:
|
||||
type: ed25519
|
||||
path: "{{ ssh_key_path }}"
|
||||
@@ -21,5 +21,5 @@
|
||||
delegate_to: "{{ repo_server_inventory_hostname }}"
|
||||
ansible.posix.authorized_key:
|
||||
user: "{{ repo_server_user }}"
|
||||
key: "{{ ssh_key_pair.public_key }}"
|
||||
key: "{{ borgmatic_ssh_key_pair.public_key }}"
|
||||
state: present
|
||||
|
||||
@@ -37,22 +37,22 @@
|
||||
# we are looking for Borg installed in a directory that Max Hoesel's role exects to find it
|
||||
- name: "Get the currently installed version of Borg"
|
||||
changed_when: false
|
||||
register: borg_version_installed
|
||||
register: borgmatic_version_installed
|
||||
ansible.builtin.command:
|
||||
cmd: /usr/bin/borg --version
|
||||
|
||||
- name: "Check that the correct version of Borg is installed"
|
||||
ansible.builtin.assert:
|
||||
that: borg_version_installed.stdout.find(borg_version)
|
||||
fail_msg: "The expected Borg version was not found: {{ borg_version_installed }}"
|
||||
success_msg: "Found the expected Borg version ({{ borg_version }})"
|
||||
that: borgmatic_version_installed.stdout.find(borgmatic_version)
|
||||
fail_msg: "The expected Borg version was not found: {{ borgmatic_version_installed }}"
|
||||
success_msg: "Found the expected Borg version ({{ borgmatic_version }})"
|
||||
|
||||
rescue:
|
||||
- name: "Download Borg from a custom URL: '{{ borg_binary_url }}'"
|
||||
- name: "Download Borg from a custom URL: '{{ borgmatic_binary_url }}'"
|
||||
retries: 3
|
||||
delay: 1
|
||||
ansible.builtin.unarchive:
|
||||
src: "{{ borg_binary_url }}"
|
||||
src: "{{ borgmatic_binary_url }}"
|
||||
dest: "/opt/"
|
||||
remote_src: true
|
||||
owner: root
|
||||
|
||||
Reference in New Issue
Block a user