ansible-role-gopass/tasks/main.yml
Adrien Reslinger 57b7854220
All checks were successful
continuous-integration/drone/push Build is passing
Fix rpm download
2021-01-26 22:24:45 +01:00

68 lines
1.9 KiB
YAML

---
- name: Install gopass
tags:
- gopass
block:
- name: Include vars for {{ ansible_os_family }}
include_vars: "{{ ansible_os_family }}.yml"
- name: Install gopass packages dependencies
package:
name: "{{ gopass_packages }}"
state: present
update_cache: yes
- name: Check if gopass is already installed
stat:
path: /usr/local/bin/gopass
register: gopass
check_mode: no
- name: Check local version installed
shell: set -o pipefail && gopass --version | sed 's|gopass \([^ ,+]*\).*|\1|'
register: gopass_locver
changed_when: false
check_mode: no
when:
- gopass.stat.exists
- name: Check online version
shell: set -o pipefail && curl -s {{ gopass_base_url }}/releases/latest | sed 's|.*tag/v\(.*\)".*|\1|'
register: gopass_ver
changed_when: false
check_mode: no
- name: Download gopass
block:
- name: Install the gopass rpm from a remote repo for yum distro
yum:
name: "{{ gopass_dl_url }}/v{{ gopass_ver.stdout }}/{{ gopass_file }}.rpm"
state: present
disable_gpg_check: yes
when:
- ansible_pkg_mgr == "yum"
- name: Install the gopass rpm from a remote repo for dnf distro
dnf:
name: "{{ gopass_dl_url }}/v{{ gopass_ver.stdout }}/{{ gopass_file }}.rpm"
state: present
disable_gpg_check: yes
when:
- ansible_pkg_mgr == "dnf"
- name: Install the gopass deb package from the internet for deb distro
apt:
deb: "{{ gopass_dl_url }}/v{{ gopass_ver.stdout }}/{{ gopass_file }}.deb"
state: present
when:
- ansible_pkg_mgr == "apt"
when:
- not gopass.stat.exists or ( gopass_locver.stdout != gopass_ver.stdout )
- name: Create pass link
file:
src: "gopass"
dest: "/usr/local/bin/pass"
owner: root
group: root
state: link