--- - name: Check if nvim is installed ansible.builtin.command: which nvim changed_when: false register: nvim_installed failed_when: nvim_installed.rc > 1 - name: Request nvim install if nvim missing ansible.builtin.set_fact: nvim_install_needed: "{{ nvim_install_needed | default(true) }}" when: nvim_installed.rc == 1 - name: Check if nvim needs update # noqa risky-shell-pipe ansible.builtin.shell: | set pipefail nvim --version | head -n 1 | awk -F '-' '{ print $NF }' | cut -d '+' -f2 | cut -c2- changed_when: false register: nvim_installed_version when: nvim_installed.rc == 0 - name: Get nvim remote version # noqa risky-shell-pipe ansible.builtin.shell: | set pipefail # yamllint disable-line rule:line-length NVIM_HEAD_VER="$(git ls-remote --heads https://github.com/neovim/neovim.git master \ | awk '{ print $1 }' \ | head -c 9)" echo $NVIM_HEAD_VER >&2 printf "%s\n" "${NVIM_HEAD_VER}" changed_when: false register: nvim_remote_version when: nvim_installed.rc == 0 - name: Request nvim install if nvim update needed ansible.builtin.set_fact: nvim_install_needed: "{{ nvim_install_needed | default(true) }}" when: nvim_installed.rc == 0 and nvim_remote_version.stdout | default() != nvim_installed_version.stdout | default() - name: Handle neovim install for Unix systems # TODO: Actually limit the targetting of this to Unix systems when: nvim_install_needed is defined and nvim_install_needed is true block: - name: Create working directory ansible.builtin.tempfile: state: directory prefix: neovim-checkout- register: nvim_work_dir - name: Checkout Neovim Master from Git # noqa latest ansible.builtin.git: repo: "{{ nvim_git_url }}" dest: "{{ nvim_work_dir.path }}" force: true update: true - name: Build Neovim community.general.make: chdir: "{{ nvim_work_dir.path }}" params: NUM_THREADS: 8 CMAKE_BUILD_TYPE: Release - name: Install Neovim become: true community.general.make: chdir: "{{ nvim_work_dir.path }}" target: install