127 lines
3.3 KiB
YAML
127 lines
3.3 KiB
YAML
---
|
|
- hosts: all
|
|
vars:
|
|
common_packages:
|
|
- ripgrep
|
|
- tree
|
|
- gcc
|
|
- fish
|
|
- zoxide
|
|
- git
|
|
- tldr
|
|
- fzf
|
|
|
|
brew_packages:
|
|
- neovim
|
|
- difftastic
|
|
- fd
|
|
|
|
pacman_packages:
|
|
- neovim
|
|
- difftastic
|
|
- fd
|
|
|
|
apt_packages:
|
|
- fd-find
|
|
|
|
uv_tools_default_python: '3.12'
|
|
|
|
uv_packages:
|
|
# python 3.12 is used by default
|
|
# if package requires another version, specify item
|
|
# - name: numpy
|
|
# python: 3.8
|
|
- name: aider-chat
|
|
- name: asciinema
|
|
- name: poetry
|
|
- name: basedpyright
|
|
- name: pre-commit
|
|
- name: posting
|
|
- name: ipython
|
|
|
|
macos_fish_path: /usr/local/bin/fish
|
|
arch_fish_path: /usr/bin/fish
|
|
|
|
tasks:
|
|
- name: Check the current OS family
|
|
ansible.builtin.set_fact:
|
|
is_macos: "{{ ansible_facts['os_family'] == 'Darwin' }}"
|
|
is_arch: "{{ ansible_facts['os_family'] == 'Archlinux' }}"
|
|
is_ubuntu: "{{ ansible_facts['os_family'] == 'Debian' }}"
|
|
|
|
- name: Get full packages list (macOS)
|
|
ansible.builtin.set_fact:
|
|
packages: "{{ common_packages + brew_packages }}"
|
|
when: is_macos
|
|
|
|
- name: Get full packages list (Manjaro)
|
|
ansible.builtin.set_fact:
|
|
packages: "{{ common_packages + pacman_packages }}"
|
|
when: is_arch
|
|
|
|
- name: Install packages (macOS)
|
|
community.general.homebrew:
|
|
name: "{{ packages }}"
|
|
state: present
|
|
when: is_macos
|
|
|
|
- name: Install packages (Manjaro)
|
|
community.general.pacman:
|
|
name: "{{ packages }}"
|
|
state: present
|
|
become: true
|
|
when: is_arch
|
|
|
|
- name: Install packages (Ubuntu)
|
|
when: is_ubuntu
|
|
become: true
|
|
ansible.builtin.apt:
|
|
pkg: "{{ common_packages }}"
|
|
cache_valid_time: 3600
|
|
|
|
- name: Install Neovim (Ubuntu)
|
|
when: is_ubuntu
|
|
block:
|
|
- name: Create a temporary directory
|
|
ansible.builtin.tempfile:
|
|
state: directory
|
|
prefix: uv_temp_
|
|
register: temp_dir
|
|
|
|
- name: Download Neovim tarball
|
|
ansible.builtin.get_url:
|
|
url: 'https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz'
|
|
dest: "{{ temp_dir.path }}/nvim.tar.gz"
|
|
mode: 'u=r,g=,o='
|
|
|
|
- name: Unpack the tarball
|
|
become: true
|
|
ansible.builtin.unarchive:
|
|
src: "{{ temp_dir.path }}/nvim.tar.gz"
|
|
dest: "/opt"
|
|
remote_src: true
|
|
|
|
- name: Clean up temporary directory
|
|
ansible.builtin.file:
|
|
path: "{{ temp_dir.path }}"
|
|
state: absent
|
|
|
|
- name: Install uv packages
|
|
ansible.builtin.command: "uv tool install --python {{ item.python | default(uv_tools_default_python) }} {{ item.name }}"
|
|
register: uv_install_result
|
|
changed_when: "'is already installed' not in uv_install_result.stderr"
|
|
loop: "{{ uv_packages }}"
|
|
tags:
|
|
- dev_tools
|
|
|
|
- name: Set fish as default shell
|
|
become: true
|
|
ansible.builtin.user:
|
|
name: "{{ ansible_env.USER }}"
|
|
shell: "{{ shell_path }}"
|
|
vars:
|
|
shell_path: "\
|
|
{% if is_macos %}{{ macos_fish_path }}\
|
|
{% elif is_arch %}{{ arch_fish_path }}\
|
|
{% else %}/bin/fish\
|
|
{% endif %}"
|