Files
ansible_role_package/tasks/pkgs/bashls.yml
2026-04-18 12:50:17 -06:00

68 lines
2.1 KiB
YAML

# vim: set filetype=yaml.ansible :
#
## Package: bashls
## Description: language server for bash (sh compatible)
## Version: latest
## Methods: source
## Helpers: npm
---
- name: Set bashls default facts # {{{
ansible.builtin.set_fact:
bashls:
methods:
Archlinux: [system, source]
default: [source]
pkgname:
default: bash-language-server
- name: Finalise bashls default facts
ansible.builtin.set_fact:
bashls:
methods: "{{ bashls.methods[os_family] | default(bashls.methods.default) }}"
npm_pkg:
name: bash-language-server
global: true
version: latest
pkgname: "{{ bashls.pkgname[os_famly] | default(bashls.pkgname.default) }}"
# }}}
- name: Configure bashls
when:
- "'bashls' not in __configured"
block:
- name: Set bashls install method
when:
- bashls_imethod is undefined
ansible.builtin.set_fact:
bashls_imethod: "{{ imethod if imethod in bashls.methods else bashls.methods[0] }}"
- name: Configure bashls system install
when:
- bashls_imethod == 'system'
block:
- name: Queue bashls system install
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + [bashls.pkgname] }}"
bashls_install: "{{ bashls_imethod }}={{ bashls.pkgname }}"
- name: Configure bashls source install
when:
- bashls_imethod == 'source'
block:
- name: Set bashls npm_pkg config
ansible.builtin.set_fact:
bashls_npm_pkg:
name: "{{ bashls.npm_pkg.name }}"
global: "{{ bashls.npm_pkg.global }}"
version: "{{ bashls_version | default(bashls.npm_pkg.version) }}"
- name: Append bashls to pkg_npm
ansible.builtin.set_fact:
pkg_npm: "{{ pkg_npm + [bashls_npm_pkg] }}"
- name: Finalise bashls source install
ansible.builtin.set_fact:
bashls_install: "{{ bashls_imethod }}={{ bashls_npm_pkg }}"
- name: Set bashls_configured
ansible.builtin.set_fact:
__configured: "{{ __configured | combine( { 'bashls': bashls_install } ) }}"