dotfiles/.local/share/dotfiles/install_dev_tools.yml

86 lines
2 KiB
YAML

---
- hosts: all
vars:
common_packages:
- neovim
- ripgrep
- fd
- tree
- gcc
- fish
- zoxide
- git
- difftastic
- tldr
- uv
brew_packages:
pacman_packages:
uv_packages:
- aider-chat
- asciinema
- poetry
- basedpyright
- pre-commit
- posting
- 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 uv packages
ansible.builtin.command: "pipx tool install {{ item }}"
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 %}"