Skip to content

Commit

Permalink
Ansible-lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
FuzzyMistborn committed Mar 23, 2023
1 parent 07d5616 commit b7cbd6f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
6 changes: 1 addition & 5 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -16,10 +16,6 @@ galaxy_info:
- name: Ubuntu
versions:
- all
- name: GenericLinux
versions:
- all
- any
- name: Debian
versions:
- all
Expand Down
9 changes: 5 additions & 4 deletions tasks/install_autorestic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand All @@ -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 )
14 changes: 10 additions & 4 deletions tasks/install_restic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand All @@ -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 )

0 comments on commit b7cbd6f

Please sign in to comment.