1 Commits

Author SHA1 Message Date
1186cfe33f Update neovim role to work on Ubuntu 18.04 2022-05-03 20:08:13 +01:00
21 changed files with 84 additions and 148 deletions

View File

@@ -1,5 +0,0 @@
---
- name: install homebrew package
apt:
name: the_silver_searcher
state: latest

View File

@@ -1,6 +0,0 @@
---
- name: install apt package
become: true
apt:
name: silversearcher-ag
state: latest

View File

@@ -1,5 +0,0 @@
---
- name: install choco package
win_chocolatey:
name: ag
state: latest

View File

@@ -1,2 +0,0 @@
---
- include_tasks: '{{ansible_os_family}}.yaml'

View File

@@ -1,5 +0,0 @@
---
- name: install homebrew package
homebrew:
name: llvm
state: latest

View File

@@ -1,2 +0,0 @@
---
- include_tasks: '{{ansible_distribution}}-{{ansible_distribution_version}}.yaml'

View File

@@ -1,50 +0,0 @@
---
- name: get list of releases from github
uri:
url: https://api.github.com/repos/llvm/llvm-project/releases
register: releases
- name: select latest release with Ubuntu binaries
set_fact:
release: '{{releases.json | json_query("[?assets | [?contains(name, `x86_64-linux-gnu-ubuntu`)]] | [0]")}}'
- name: select from latest available release with x86_64-linux-gnu-ubuntu asset
set_fact:
asset: '{{release | json_query("assets | [?contains(name, `x86_64-linux-gnu-ubuntu`)] | [?ends_with(name, `.tar.xz`)] | [0]")}}'
- name: process release name for /usr/local/lib/{{package_name}}
set_fact:
package_name: '{{release.name | lower | regex_replace(" (\d+)\.\d+\.\d+", "-\1")}}'
- name: set path for archive download
set_fact:
archive_path: '/tmp/{{asset.name}}'
- name: download release archive
get_url:
url: '{{asset.browser_download_url}}'
dest: '{{archive_path}}'
- name: create package directory
become: true
file:
path: '/usr/local/lib/{{package_name}}'
state: directory
# TODO: don't extract when not actually doing a n update
- name: extract release archive
become: true
unarchive:
src: '{{archive_path}}'
dest: '/usr/local/lib/{{package_name}}'
extra_opts: ['--strip-components', '1']
- name: create symlinks from /usr/local/lib/{package_name}} to /usr/local/bin
become: true
file:
src: '{{item}}'
dest: '/usr/local/bin/{{item | basename}}'
state: link
with_fileglob: '/usr/local/lib/{{package_name}}/bin/*'
# TODO: cleanup old installs?

View File

@@ -1,5 +0,0 @@
---
- name: install chocolatey package
win_chocolatey:
name: llvm
state: latest

View File

@@ -1,2 +0,0 @@
---
- include_tasks: '{{ansible_os_family}}.yaml'

View File

@@ -1,7 +1,11 @@
--- ---
- name: install homebrew packages - name: install homebrew packages
homebrew: homebrew:
name: neovim name:
- neovim
- llvm
- node
- the_silver_searcher
state: latest state: latest
- include_tasks: unix.yaml - include_tasks: unix.yaml

View File

@@ -1,13 +1,11 @@
--- ---
- name: install apt packages - name: install Debian-unstable apt packages
become: true become: true
apt: apt:
name: name:
- clang - neovim
- clang-format - clang-format
- clang-tidy - clang-tidy
- clang-tools
- clangd - clangd
- llvm - silversearcher-ag
state: latest state: latest
install_recommends: true

View File

@@ -1,8 +1,31 @@
--- ---
- name: install apt package - include_tasks: '{{ansible_distribution}}-{{ansible_distribution_version}}.yaml'
become: true - include_tasks: 'unix.yaml'
apt:
name: neovim
state: latest
- include_tasks: unix.yaml - name: nodejs get json containing latest version
uri:
url: https://nodejs.org/dist/index.json
register: latest
- name: nodejs create directory for downloaded package
file:
state: directory
dest: ~/.local/src
- name: nodejs download latest package
get_url:
url: 'https://nodejs.org/dist/{{latest.json[0].version}}/node-{{latest.json[0].version}}-linux-x64.tar.gz'
dest: ~/.local/src/node.tar.gz
- name: nodejs extract downloaded package
unarchive:
src: ~/.local/src/node.tar.gz
dest: ~/.local/src
remote_src: true
- name: nodejs create symlink links
file:
state: link
src: '~/.local/src/node-{{latest.json[0].version}}-linux-x64/bin/{{item}}'
dest: '~/.local/bin/{{item}}'
with_items: [corepack, node, npm, npx]

View File

@@ -0,0 +1,34 @@
---
- name: get releases json from github
uri:
url: https://api.github.com/repos/neovim/neovim/releases
register: releases
- name: query the latest stable release
set_fact:
stable: '{{releases.json | json_query("[?tag_name==`stable`]")}}'
- name: query the nvim-linux64.deb.sha256sum asset
set_fact:
sha_asset: '{{stable[0].assets | json_query("[?name==`nvim-linux64.deb.sha256sum`]")}}'
- name: query the nvim-linux64.deb asset
set_fact:
deb_asset: '{{stable[0].assets | json_query("[?name==`nvim-linux64.deb`]")}}'
- name: create directory for downloads
file:
state: directory
path: ~/.cache/nvim/deb
- name: download nvim-linux64.deb with checksum
get_url:
url: '{{deb_asset[0].browser_download_url}}'
dest: ~/.cache/nvim/deb/nvim-linux64.deb
checksum: 'sha256:{{sha_asset[0].browser_download_url}}'
- name: install nvim-linux64.deb package
become: true
apt:
deb: ~/.cache/nvim/deb/nvim-linux64.deb
# TODO: clangd, clang-format, clang-tidy
- name: install Ubuntu-18.04 apt packages
become: true
apt:
name:
- silversearcher-ag

View File

@@ -1,7 +1,11 @@
--- ---
- name: install choco packages - name: install choco packages
win_chocolatey: win_chocolatey:
name: neovim name:
- neovim
- ag
- llvm
- nodejs
state: latest state: latest
- name: clone config repo - name: clone config repo
@@ -10,12 +14,12 @@
dest: '{{ansible_env.LOCALAPPDATA}}/nvim' dest: '{{ansible_env.LOCALAPPDATA}}/nvim'
version: master version: master
# - TODO: neovim set repo email # TODO: - name: neovim set repo email
# win_git_config: # win_git_config:
# - TODO: neovim install pip packages # TODO: - name: neovim install pip packages
# win_pip: # win_pip:
# name: '{{neovim_pip_packages}}' # name: '{{neovim_pip_packages}}'
# state: latest # state: latest
- name: create nvim start menu shortcut - name: create nvim start menu shortcut
win_shortcut: win_shortcut:

View File

@@ -1,5 +0,0 @@
---
- name: install homebrew package
homebrew:
name: node
state: latest

View File

@@ -1,28 +0,0 @@
---
- name: get json containing latest version
uri:
url: https://nodejs.org/dist/index.json
register: latest
- name: create directory for downloaded package
file:
state: directory
dest: ~/.local/src
- name: download latest package
get_url:
url: 'https://nodejs.org/dist/{{latest.json[0].version}}/node-{{latest.json[0].version}}-linux-x64.tar.gz'
dest: ~/.local/src/node.tar.gz
- name: extract downloaded package
unarchive:
src: ~/.local/src/node.tar.gz
dest: ~/.local/src
remote_src: true
- name: create symlink links
file:
state: link
src: '~/.local/src/node-{{latest.json[0].version}}-linux-x64/bin/{{item}}'
dest: '~/.local/bin/{{item}}'
with_items: [corepack, node, npm, npx]

View File

@@ -1,5 +0,0 @@
---
- name: install choco package
win_chocolatey:
name: nodejs
state: latest

View File

@@ -1,2 +0,0 @@
---
- include_tasks: '{{ansible_os_family}}.yaml'

View File

@@ -1,6 +1,5 @@
--- ---
- name: install apt packages - name: install apt packages
become: true
apt: apt:
name: name:
- python3 - python3

View File

@@ -4,8 +4,6 @@
roles: roles:
- role: zsh - role: zsh
- role: tmux - role: tmux
- role: git
- role: neovim - role: neovim
- role: ag - role: git
- role: nodejs
- role: python - role: python

View File

@@ -13,10 +13,8 @@
roles: roles:
- role: powershell - role: powershell
- role: git
- role: neovim - role: neovim
- role: ag - role: git
- role: nodejs
- role: python - role: python
- role: autohotkey - role: autohotkey
- role: 1password - role: 1password