# vim: set filetype=yaml.ansible : # ## Package: ansible_ls ## Description: language server for ansible yaml ## Version: latest ## Methods: ## - source (npm) ## - system ## Helpers: npm --- - name: Set ansible_ls default facts # {{{ ansible.builtin.set_fact: ansible_ls: install_methods: - source - system npm_pkg: name: '@ansible/ansible-language-server' global: true version: latest pkg_deps: - nodejs # }}} - name: Configure ansible_ls when: - "'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: "{{ install_method if install_method in ansible_ls.install_methods else ansible_ls.install_methods[0] }}" - name: Configure ansible_ls source install when: - ansible_ls_install_method == 'source' block: - name: Load required installation dependencies loop: "{{ ansible_ls.pkg_deps }}" loop_control: loop_var: dep ansible.builtin.include_tasks: "pkgs/{{ dep }}.yml" - name: Set ansible_ls npm_pkg config ansible.builtin.set_fact: ansible_ls_npm_pkg: name: "{{ ansible_ls.npm_pkg.name }}" global: "{{ ansible_ls.npm_pkg.global }}" version: "{{ ansible_ls_version | default(ansible_ls.npm_pkg.version) }}" - name: Append ansible ls to pkg_npm ansible.builtin.set_fact: pkg_npm: "{{ pkg_npm + [ansible_ls_npm_pkg] }}" - name: Set ansible_ls_configured ansible.builtin.set_fact: __configured: "{{ __configured | combine( { 'ansible_ls': ansible_ls_install_method } ) }}"