feat: add neovim install

This commit is contained in:
Price Hiller 2022-08-01 21:03:44 -05:00
parent 658f27b224
commit 51d2a35549
2 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,33 @@
---
- name: Create working directory
ansible.builtin.tempfile:
state: directory
register: nvim_work_dir
- name: Set install variables
ansible.builtin.set_fact:
# yamllint disable-line rule:line-length
nvim_url: "{{ 'https://github.com/neovim/neovim/releases/download/' + nvim_release_stream | default('nightly') + '/nvim-' + nvim_platform | default('linux64') + '.tar.gz' }}"
nvim_checksum: "{{ 'sha256:' + nvim_url + '.sha256sum' }}"
nvim_archive_dest: "{{ nvim_work_dir.path + '/nvim.tar.gz' }}"
nvim_unpacked_dest: "{{ nvim_work_dir.path + '/nvim-unpacked' }}"
- name: Download neovim archive from releases
become: true
ansible.builtin.get_url:
url: "{{ nvim_url }}"
checksum: "{{ nvim_checksum }}"
dest: "{{ nvim_archive_dest }}"
mode: 0644
- name: Extract neovim archive
become: true
ansible.builtin.unarchive:
src: "{{ nvim_archive_dest }}"
dest: "{{ nvim_unpacked_dest }}"
- name: Copy neovim files into place
become: true
ansible.posix.synchronize:
src: "{{ nvim_unpacked_dest }}"
dest: "{{ nvim_sync_dest_dir | default('/usr/') }}"

View File

@ -1,2 +1,17 @@
---
# tasks file for nvim
- name: Check unix os
ansible.builtin.command: uname
ignore_errors: true
changed_when: false
register: uname
- name: Install Neovim for Linux
ansible.builtin.include_tasks: install-nvim.yml
when: uname.stdout == 'Linux'
- name: Install Neovim for MacOS
ansible.builtin.include_tasks: install-nvim.yml
vars:
nvim_platform: "macos"
when: uname.stdout == 'Darwin'