From b7cbd6f4ce5c19d61f0c107dc8e75fc34b4f293e Mon Sep 17 00:00:00 2001 From: FuzzyMistborn Date: Thu, 23 Mar 2023 14:01:37 -0400 Subject: [PATCH] Ansible-lint fixes --- meta/main.yml | 6 +----- tasks/install_autorestic.yml | 9 +++++---- tasks/install_restic.yml | 14 ++++++++++---- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/meta/main.yml b/meta/main.yml index 293b586..a9b0526 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -5,7 +5,7 @@ galaxy_info: description: Installs restic/autorestic and creates backup configuration file issue_tracker_url: https://github.com/FuzzyMistborn/ansible-role-autorestic/issues license: GPLv3 - min_ansible_version: 2.4 + min_ansible_version: '2.4' platforms: - name: Fedora versions: @@ -16,10 +16,6 @@ galaxy_info: - name: Ubuntu versions: - all - - name: GenericLinux - versions: - - all - - any - name: Debian versions: - all diff --git a/tasks/install_autorestic.yml b/tasks/install_autorestic.yml index 8b9ebdb..4d0bdbf 100644 --- a/tasks/install_autorestic.yml +++ b/tasks/install_autorestic.yml @@ -34,7 +34,9 @@ autorestic_ver: "{{ autorestic_pinned_ver }}" when: autorestic_download_latest_ver == False -- block: +- name: Install Autorestic + when: autorestic_is_installed == False or ( autorestic_is_installed == True and autorestic_download_latest_ver == True and installed_version_registered.stdout != autorestic_ver ) or ( autorestic_is_installed == True and autorestic_download_latest_ver == False and installed_version_registered.stdout != autorestic_pinned_ver ) + block: - name: Ensure autorestic_download_directory does not exist ansible.builtin.file: path: "{{ autorestic_download_directory }}" @@ -61,9 +63,8 @@ state: present - name: Set autorestic filename - ansible.builtin.set_fact: file_name="autorestic_{{ autorestic_ver }}_{{ autorestic_distro }}.bz2" + ansible.builtin.set_fact: + file_name: "autorestic_{{ autorestic_ver }}_{{ autorestic_distro }}.bz2" - name: Unzip autorestic release ansible.builtin.shell: "cd {{ autorestic_download_directory }} && bzip2 -d {{ file_name }} && mv {{ file_name | regex_replace('.bz2') }} {{ autorestic_install_path }}" - - when: autorestic_is_installed == False or ( autorestic_is_installed == True and autorestic_download_latest_ver == True and installed_version_registered.stdout != autorestic_ver ) or ( autorestic_is_installed == True and autorestic_download_latest_ver == False and installed_version_registered.stdout != autorestic_pinned_ver ) diff --git a/tasks/install_restic.yml b/tasks/install_restic.yml index 4cd8d64..b89867b 100644 --- a/tasks/install_restic.yml +++ b/tasks/install_restic.yml @@ -34,7 +34,9 @@ restic_ver: "{{ restic_pinned_ver }}" when: restic_download_latest_ver == False -- block: +- name: Install restic + when: restic_is_installed == False or ( restic_is_installed == True and restic_download_latest_ver == True and installed_version_registered.stdout != restic_ver ) or ( restic_is_installed == True and restic_download_latest_ver == False and installed_version_registered.stdout != restic_pinned_ver ) + block: - name: Ensure restic_download_directory does not exist ansible.builtin.file: path: "{{ restic_download_directory }}" @@ -55,10 +57,14 @@ group: root mode: +x + - name: Ensure bzip2 is installed + ansible.builtin.package: + name: bzip2 + state: present + - name: Set restic filename - ansible.builtin.set_fact: file_name="restic_{{ restic_ver }}_{{ restic_distro }}.bz2" + ansible.builtin.set_fact: + file_name: "restic_{{ restic_ver }}_{{ restic_distro }}.bz2" - name: Unzip restic release ansible.builtin.shell: "cd {{ restic_download_directory }} && bzip2 -d {{ file_name }} && mv {{ file_name | regex_replace('.bz2') }} {{ restic_install_path }}" - - when: restic_is_installed == False or ( restic_is_installed == True and restic_download_latest_ver == True and installed_version_registered.stdout != restic_ver ) or ( restic_is_installed == True and restic_download_latest_ver == False and installed_version_registered.stdout != restic_pinned_ver )