Small refactoring; fish, zoxide, git, difftastic installation

This commit is contained in:
Ivan Golikov 2024-12-15 12:15:03 +01:00
parent cfce603631
commit d3dac17247

View file

@ -1,33 +1,48 @@
---
- name: Install development tools
hosts: localhost
gather_facts: true
tasks:
- name: Install packages with homebrew
community.general.homebrew:
name:
- neovim
- ripgrep
- fd
- tree
- gcc
state: present
when: ansible_facts['os_family'] == "Darwin"
- hosts: all
vars:
common_packages:
- neovim
- ripgrep
- fd
- tree
- gcc
- fish
- zoxide
- git
- difftastic
- name: Install packages with pacman
brew_packages:
- pipx
pacman_packages:
- python-pipx
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' }}"
- 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:
- neovim
- ripgrep
- fd
- tree
- gcc
name: "{{ packages }}"
state: present
become: true
when: ansible_facts['os_family'] == "Archlinux"
- name: Ensure dotfiles alias exists in .zshrc
ansible.builtin.lineinfile:
path: "{{ ansible_env.HOME }}/.zshrc"
line: "alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'"
create: yes
when: is_arch