fix ansible_ls
This commit is contained in:
@@ -2,53 +2,32 @@
|
||||
---
|
||||
- name: Configure ansible_lint
|
||||
when:
|
||||
- __ansible_lint_configured is undefined or
|
||||
not __ansible_lint_configured
|
||||
- "'ansible_lint' not in __configured"
|
||||
block:
|
||||
- name: Set basic variables
|
||||
ansible.builtin.set_fact:
|
||||
ansible_lint_version: "{{ ansible_lint_version | default('latest') }}"
|
||||
|
||||
- name: Set ansible_lint install method
|
||||
when:
|
||||
- ansible_lint_install_method is undefined
|
||||
ansible.builtin.set_fact:
|
||||
ansible_lint_install_method: "{% if install_method in ansible_lint_install_methods %}{{ install_method }}{% else %}{{ ansible_lint_install_methods[0] }}{% endif %}"
|
||||
ansible_lint_install_method: "{{ install_method if install_method in ansible_lint_install_methods else ansible_lint_methods[0] }}"
|
||||
|
||||
- name: Set pipx pkgnname
|
||||
when:
|
||||
- ansible_lint_install_method == 'pipx' or
|
||||
ansible_lint_install_method == 'system_pip'
|
||||
- ansible_lint_install_method == 'source'
|
||||
ansible.builtin.set_fact:
|
||||
ansible_lint_pkgname: "{{ 'ansible_lint' if ansible_lint_version == 'latest' else 'ansible-lint==' ~ ansible_lint_version }}"
|
||||
ansible_lint_pkgname: "{{ ansible_lint_pkgname['pipx'] }}{{ '==' ~ ansible_lint_version if ansible_lint_version != 'latest' }}"
|
||||
|
||||
- name: Set package name
|
||||
- name: Add ansible_lint to pipx install list
|
||||
when:
|
||||
- install_method == 'system'
|
||||
- ansible_lint_install_method == 'source'
|
||||
ansible.builtin.set_fact:
|
||||
ansible_lint_pkgname:
|
||||
RedHat: ansible-lint
|
||||
Debian: ansible-lint
|
||||
Archlinux: ansible-lint
|
||||
Alpine: ansible-lint
|
||||
FreeBSD: py311-ansible-lint
|
||||
pkg_pipx: "{{ pkg_pipx + [ansible_lint_pkgname] }}"
|
||||
|
||||
- name: Append ansible-lint to system install list
|
||||
when:
|
||||
- ansible_lint_install_method == 'system'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + [ansible_lint_pkgname[ansible_os_family]] }}"
|
||||
|
||||
- name: Complete ansible_lint configuration
|
||||
ansible.builtin.set_fact:
|
||||
__ansible_lint_configured: true
|
||||
|
||||
- name: Add ansible_lint to pipx install list
|
||||
when:
|
||||
- ansible_lint_install_method == 'pipx'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_pipx: "{{ pkg_pipx + [ansible_lint_pkgname] }}"
|
||||
|
||||
- name: Add ansible_lint to system_pip install list
|
||||
when:
|
||||
- ansible_lint_install_method == 'system_pip'
|
||||
|
||||
- name: Append ansible-lint to system install list
|
||||
when:
|
||||
- ansible_lint_install_method == 'system'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + [ansible_lint_pkgname[ansible_os_family]] }}"
|
||||
__configured: "{{ __configured | combine( { 'ansible_lint': true } ) }}"
|
||||
|
||||
@@ -2,30 +2,28 @@
|
||||
---
|
||||
- name: Configure ansible_ls
|
||||
when:
|
||||
- __ansible_ls_configured is undefined
|
||||
- "'ansible_ls' not in __configured"
|
||||
block:
|
||||
- name: Set ansible_ls install method
|
||||
when:
|
||||
- ansible_ls_install_method is undefined
|
||||
ansible.builtin.set_fact:
|
||||
ansible_ls_install_method: "{% if install_method in ansible_ls_install_methods %}{{ install_method }}{% else %}{{ ansible_ls_install_methods[0] }}{% endif %}"
|
||||
|
||||
- name: Configure ansible_ls source npm installation
|
||||
when:
|
||||
- ansible_ls_install_method == 'source'
|
||||
ansible.builtin.set_fact:
|
||||
ansible_npm_pkg:
|
||||
name: '@ansible/ansible-language-server'
|
||||
global: true
|
||||
ansible_ls_install_method: "{{ install_method if install_method in ansible_ls_install_methods else ansible_ls_install_methods[0] }}"
|
||||
|
||||
- name: Append ansible-language-server to pkg_npm
|
||||
when:
|
||||
- ansible_ls_install_method == 'source'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_npm: "{{ pkg_npm + [ansible_npm_pkg] }}"
|
||||
block:
|
||||
- name: Load required installation dependencies
|
||||
loop: "{{ ansible_ls_pkg_deps }}"
|
||||
loop_control:
|
||||
loop_var: pkgdep
|
||||
ansible.builtin.include_tasks: "{{ pkgdep }}"
|
||||
|
||||
- name: Append ansible ls to pkg_npm
|
||||
ansible.builtin.set_fact:
|
||||
pkg_npm: "{{ pkg_npm + [ansible_npm_pkg] }}"
|
||||
|
||||
- name: Set ansible_ls_configured
|
||||
when:
|
||||
- __ansible_ls_configured is undefined
|
||||
ansible.builtin.set_fact:
|
||||
__ansible_ls_configured: true
|
||||
__configured: "{{ __configured | combine( { 'ansible_ls': true } ) }}"
|
||||
|
||||
@@ -120,9 +120,26 @@ ansible_pkgname:
|
||||
Debian: ansible
|
||||
Alpine: ansible
|
||||
Archlinux: ansible
|
||||
ansible_pip_pkgname: ansible
|
||||
# }}}
|
||||
# {{{ ansible_lint
|
||||
ansible_lint_version: latest
|
||||
ansible_lint_install_methods:
|
||||
- system
|
||||
- source
|
||||
ansible_lint_pkgname:
|
||||
RedHat: ansible-lint
|
||||
Debian: ansible-lint
|
||||
Archlinux: ansible-lint
|
||||
Alpine: ansible-lint
|
||||
FreeBSD: py311-ansible-lint
|
||||
pipx: ansible_lint
|
||||
# }}}
|
||||
# {{{ ansible_ls
|
||||
ansible_ls_version: latest
|
||||
ansible_npm_pkg:
|
||||
name: '@ansible/ansible-language-server'
|
||||
global: true
|
||||
ansible_ls_pkg_deps:
|
||||
- pkgs/npm.yml
|
||||
# }}}
|
||||
|
||||
Reference in New Issue
Block a user