For my daily work I rely on some tools being available on the machines that I use. They are usually not installed on HPCs, so I like to have a simple automated way to install them with ansible.
This sets up
- ripgrep (for searching in files),
- dust (for checking what takes up how much space / files),
- fd (find alternative with easier syntax),
- fzf (fuzzy finder, I mostly use it for the ctrl-r shortcut in bash to see what I have been doing recently),
- neovim
- hosts: all
tasks:
- name: "install ripgrep 14.1.1"
unarchive:
remote_src: yes
src: "https://github.com/BurntSushi/ripgrep/releases/download/14.1.1/ripgrep-14.1.1-x86_64-unknown-linux-musl.tar.gz"
dest: "{{ ansible_env.HOME }}/bin/"
creates: "{{ ansible_env.HOME }}/bin/rg"
extra_opts:
- --strip=1
- --no-anchored
- rg
- name: "install dust 1.1.1"
unarchive:
remote_src: yes
src: "https://github.com/bootandy/dust/releases/download/v1.1.1/dust-v1.1.1-x86_64-unknown-linux-musl.tar.gz"
dest: "{{ ansible_env.HOME }}/bin/"
creates: "{{ ansible_env.HOME }}/bin/dust"
extra_opts:
- --strip=1
- --no-anchored
- dust
- name: "install fd 10.2.0"
unarchive:
remote_src: yes
src: "https://github.com/sharkdp/fd/releases/download/v10.2.0/fd-v10.2.0-x86_64-unknown-linux-musl.tar.gz"
dest: "{{ ansible_env.HOME }}/bin/"
creates: "{{ ansible_env.HOME }}/bin/fd"
extra_opts:
- --strip=1
- --no-anchored
- fd
- name: "install fzf 0.62.0"
unarchive:
remote_src: yes
src: "https://github.com/junegunn/fzf/releases/download/v0.62.0/fzf-0.62.0-linux_amd64.tar.gz"
dest: "{{ ansible_env.HOME }}/bin/"
creates: "{{ ansible_env.HOME }}/bin/fzf"
- name: "download gnu-stow (needed for dotfile management)"
unarchive:
remote_src: yes
src: "https://ftp.gnu.org/gnu/stow/stow-2.4.1.tar.gz"
dest: "{{ ansible_env.HOME }}/bin/"
creates: "{{ ansible_env.HOME }}/bin/stow-2.4.1"
- name: Configure and build gnu-stow
shell: |
./configure --prefix=$HOME
make
make install
args:
chdir: "{{ ansible_env.HOME }}/bin/stow-2.4.1"
creates: "{{ ansible_env.HOME }}/bin/stow"
# neovim!!
# this is using unsupported releases that do not require a new glibc
- name: "install neovim 0.10.2"
unarchive:
remote_src: yes
src: "https://github.com/neovim/neovim-releases/releases/download/v0.10.2/nvim-linux64.tar.gz"
dest: "{{ ansible_env.HOME }}/bin/"
creates: "{{ ansible_env.HOME }}/bin/nvim-linux64"
- name: Create symlink for neovim
file:
src: "{{ ansible_env.HOME }}/bin/nvim-linux64/bin/nvim"
dest: "{{ ansible_env.HOME }}/bin/nvim"
state: link
- name: Ensure $HOME/bin is exported in .bashrc
blockinfile:
dest: "{{ ansible_env.HOME }}/.bashrc"
block: |
export PATH="$HOME/bin:$PATH"
marker: '# {mark} ANSIBLE MANAGED BLOCK - PATH'
insertafter: EOF
create: yes
- name: Ensure fzf is set up in .bashrc
blockinfile:
dest: "{{ ansible_env.HOME }}/.bashrc"
block: |
eval "$(fzf --bash)"
marker: '# {mark} ANSIBLE MANAGED BLOCK - FZF'
insertafter: EOF
create: yes