diff --git a/.ansible-lint b/.ansible-lint index 77370e5..c3dc8ae 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,2 +1,2 @@ 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' diff --git a/handlers/main.yml b/handlers/main.yml index 93c104a..c28484f 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,4 +1,4 @@ --- -- name: systemd reload +- name: Reload systemd ansible.builtin.systemd: - daemon_reload: yes + daemon_reload: true diff --git a/meta/main.yml b/meta/main.yml index f69ac56..2b13546 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -3,15 +3,15 @@ galaxy_info: author: angristan description: Ansible role for Restic license: MIT - min_ansible_version: 2.4 + min_ansible_version: "2.4" platforms: - - name: Debian - versions: - - all - - name: Ubuntu - versions: - - all + - name: Debian + versions: + - all + - name: Ubuntu + versions: + - all galaxy_tags: - debian diff --git a/tasks/install.yml b/tasks/install.yml index 394d03a..8a824a5 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -1,23 +1,24 @@ --- - name: Install fuse (to mount repositories) - apt: + ansible.builtin.apt: name: fuse - name: Install bzip2 (to install restic) - apt: + ansible.builtin.apt: name: bzip2 - name: Install pigz (to compress db dumps) - apt: + ansible.builtin.apt: name: pigz - name: Download restic ansible.builtin.get_url: 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" + mode: "0644" - 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: creates: "/tmp/restic_{{ restic_version }}_linux_amd64" @@ -26,7 +27,7 @@ remote_src: true src: "/tmp/restic_{{ restic_version }}_linux_amd64" dest: "{{ restic_path }}" - mode: 0755 + mode: "0755" - name: Remove downloaded file ansible.builtin.file: diff --git a/tasks/main.yml b/tasks/main.yml index 8a6d9a0..e2ed9d6 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -4,7 +4,8 @@ path: "{{ restic_path }}" 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 - name: Overwrite SSH config for backup server @@ -38,14 +39,14 @@ mode: "0644" vars: restic_folders_combined: "{{ restic_default_folders + restic_folders }}" - notify: systemd reload + notify: Reload systemd - name: Add systemd timer for restic ansible.builtin.template: src: restic-backup.timer.j2 dest: /etc/systemd/system/restic-backup.timer mode: "0644" - notify: systemd reload + notify: Reload systemd - name: Enable and start restic timer ansible.builtin.systemd: