Files
ansible_role_package/tasks/pkgs/lazygit.yml

69 lines
2.2 KiB
YAML

# vim: set filetype=yaml.ansible :
#
## Package: lazygit
## Description: great looking and functional tui git manager
## Version: latest
## Methods: source
## Helpers: go_install
---
- name: Set lazygit default facts # {{{
ansible.builtin.set_fact:
lazygit:
methods:
Archlinux: [system, source]
default: [source]
pkgname:
default: lazygit
- name: Finalise lazygit default facts
ansible.builtin.set_fact:
lazygit:
methods: "{{ lazygit.methods[os_family] | default(lazygit.methods.default) }}"
pkgname: "{{ lazygit.pkgname[os_family] | default(lazygit.pkgname.default) }}"
url: github.com/jesseduffield/lazygit
version: "{{ lazygit_version | default('latest') }}"
pkg_deps:
- go
# }}}
- name: Configure lazygit
when:
- "'lazygit' not in __configured"
block:
- name: Set lazygit install method
ansible.builtin.set_fact:
lazygit_imethod: "{{ imethod if imethod in lazygit.methods else lazygit.methods[0] }}"
- name: Configure lazygit system install
when:
- lazygit_imethod == 'system'
block:
- name: Queue lazygit system install
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + [lazygit.pkgname] }}"
lazygit_install: "{{ lazygit_imethod }}={{ lazygit.pkgname }}"
- name: Configure lazygit source install
when:
- lazygit_imethod == 'source'
block:
- name: Set lazygit go install
ansible.builtin.set_fact:
lazygit_go_install:
lazygit_go_pkg:
url: "{{ lazygit.url }}@{{ lazygit.version }}"
bin: "{{ path_bin }}/lazygit"
- name: Queue lazygit go install
ansible.builtin.set_fact:
pkg_go: "{{ pkg_go + [lazygit_go_pkg] }}"
lazygit_install: "{{ lazygit_imethod }}={{ lazygit_go_install }}"
- name: Append pkg_deps to install list
loop: "{{ lazygit.pkg_deps }}"
loop_control:
loop_var: dep
ansible.builtin.include_tasks: "pkgs/{{ dep }}.yml"
- name: Finalise lazygit configuration
ansible.builtin.set_fact:
__configured: "{{ __configured | combine( { 'lazygit': lazygit_install } ) }}"