From a1ab38f0ad4b00171ad6a4deb6794de72a1ffcc5 Mon Sep 17 00:00:00 2001 From: Ricard Illa Date: Sun, 18 Sep 2022 18:06:15 +0200 Subject: [PATCH] refactored gopass install --- roles/gopass/tasks/debian.yml | 20 -------------------- roles/gopass/tasks/install.yml | 31 +++++++++++++++++++++++++++++++ roles/gopass/tasks/main.yml | 12 +----------- 3 files changed, 32 insertions(+), 31 deletions(-) delete mode 100644 roles/gopass/tasks/debian.yml create mode 100644 roles/gopass/tasks/install.yml diff --git a/roles/gopass/tasks/debian.yml b/roles/gopass/tasks/debian.yml deleted file mode 100644 index c5b5fb4..0000000 --- a/roles/gopass/tasks/debian.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- - -- name: add gopass apt key - get_url: - url: https://packages.gopass.pw/repos/gopass/gopass-archive-keyring.gpg - dest: /etc/apt/trusted.gpg.d/gopass-archive-keyring.gpg - -- name: add gopass repo - apt_repository: - repo: deb https://packages.gopass.pw/repos/gopass stable main - filename: gopass.sources - update_cache: true - state: present - -- name: install gopass - apt: - name: - - gopass - - gopass-archive-keyring - state: present diff --git a/roles/gopass/tasks/install.yml b/roles/gopass/tasks/install.yml new file mode 100644 index 0000000..0ed1709 --- /dev/null +++ b/roles/gopass/tasks/install.yml @@ -0,0 +1,31 @@ +--- + +- name: install gopass (Alpine) + apk: + name: gopass + when: ansible_distribution == "Alpine" + +- name: install gopass (Debian) + block: + - name: add gopass apt key + get_url: + url: https://packages.gopass.pw/repos/gopass/gopass-archive-keyring.gpg + dest: /etc/apt/trusted.gpg.d/gopass-archive-keyring.gpg + - name: add gopass repo + apt_repository: + repo: deb https://packages.gopass.pw/repos/gopass stable main + filename: gopass.list + update_cache: true + state: present + - name: install gopass + apt: + name: + - gopass + - gopass-archive-keyring + state: present + when: ansible_distribution in ["Debian", "Ubuntu"] + +- name: install gopass (OpenBSD) + openbsd_pkg: + name: gopass + when: ansible_distribution == "OpenBSD" diff --git a/roles/gopass/tasks/main.yml b/roles/gopass/tasks/main.yml index eec2ea8..d8f08a3 100644 --- a/roles/gopass/tasks/main.yml +++ b/roles/gopass/tasks/main.yml @@ -1,14 +1,4 @@ --- -- name: install gopass - apk: - name: gopass - when: ansible_distribution == "Alpine" - name: install gopass - include_tasks: debian.yml - when: ansible_distribution in ["Debian", "Ubuntu"] - -- name: install gopass - openbsd_pkg: - name: gopass - when: ansible_distribution == "OpenBSD" + include_tasks: install.yml