fix: comply with latest ansible-lint rules

This commit is contained in:
Stanislas Lange 2024-01-28 13:22:27 +01:00
parent 967780f160
commit e17443ad10
No known key found for this signature in database
5 changed files with 20 additions and 18 deletions

View file

@ -1,2 +1,2 @@
skip_list: skip_list:
- '106' # Role name {} does not match ``^[a-z][a-z0-9_]+$`` pattern' - "106" # Role name {} does not match ``^[a-z][a-z0-9_]+$`` pattern'

View file

@ -1,4 +1,4 @@
--- ---
- name: systemd reload - name: Reload systemd
ansible.builtin.systemd: ansible.builtin.systemd:
daemon_reload: yes daemon_reload: true

View file

@ -3,7 +3,7 @@ galaxy_info:
author: angristan author: angristan
description: Ansible role for Restic description: Ansible role for Restic
license: MIT license: MIT
min_ansible_version: 2.4 min_ansible_version: "2.4"
platforms: platforms:
- name: Debian - name: Debian

View file

@ -1,23 +1,24 @@
--- ---
- name: Install fuse (to mount repositories) - name: Install fuse (to mount repositories)
apt: ansible.builtin.apt:
name: fuse name: fuse
- name: Install bzip2 (to install restic) - name: Install bzip2 (to install restic)
apt: ansible.builtin.apt:
name: bzip2 name: bzip2
- name: Install pigz (to compress db dumps) - name: Install pigz (to compress db dumps)
apt: ansible.builtin.apt:
name: pigz name: pigz
- name: Download restic - name: Download restic
ansible.builtin.get_url: ansible.builtin.get_url:
url: "https://github.com/restic/restic/releases/download/v{{ restic_version }}/restic_{{ restic_version }}_linux_{{ ansible_architecture }}.bz2" url: "https://github.com/restic/restic/releases/download/v{{ restic_version }}/restic_{{ restic_version }}_linux_{{ ansible_architecture }}.bz2"
dest: "/tmp/restic_{{ restic_version }}_linux_amd64.bz2" dest: "/tmp/restic_{{ restic_version }}_linux_amd64.bz2"
mode: "0644"
- name: Extract restic - name: Extract restic
command: "bzip2 -d /tmp/restic_{{ restic_version }}_linux_amd64.bz2" ansible.builtin.command: "bzip2 -d /tmp/restic_{{ restic_version }}_linux_amd64.bz2"
args: args:
creates: "/tmp/restic_{{ restic_version }}_linux_amd64" creates: "/tmp/restic_{{ restic_version }}_linux_amd64"
@ -26,7 +27,7 @@
remote_src: true remote_src: true
src: "/tmp/restic_{{ restic_version }}_linux_amd64" src: "/tmp/restic_{{ restic_version }}_linux_amd64"
dest: "{{ restic_path }}" dest: "{{ restic_path }}"
mode: 0755 mode: "0755"
- name: Remove downloaded file - name: Remove downloaded file
ansible.builtin.file: ansible.builtin.file:

View file

@ -4,7 +4,8 @@
path: "{{ restic_path }}" path: "{{ restic_path }}"
register: restic_binary register: restic_binary
- include_tasks: install.yml - name: Include install.yml if restic is not installed or restic_install is true
ansible.builtin.include_tasks: install.yml
when: not restic_binary.stat.exists or restic_install when: not restic_binary.stat.exists or restic_install
- name: Overwrite SSH config for backup server - name: Overwrite SSH config for backup server
@ -38,14 +39,14 @@
mode: "0644" mode: "0644"
vars: vars:
restic_folders_combined: "{{ restic_default_folders + restic_folders }}" restic_folders_combined: "{{ restic_default_folders + restic_folders }}"
notify: systemd reload notify: Reload systemd
- name: Add systemd timer for restic - name: Add systemd timer for restic
ansible.builtin.template: ansible.builtin.template:
src: restic-backup.timer.j2 src: restic-backup.timer.j2
dest: /etc/systemd/system/restic-backup.timer dest: /etc/systemd/system/restic-backup.timer
mode: "0644" mode: "0644"
notify: systemd reload notify: Reload systemd
- name: Enable and start restic timer - name: Enable and start restic timer
ansible.builtin.systemd: ansible.builtin.systemd: