From d3dac1724740ae711fc76420d502c6b71c8b9580 Mon Sep 17 00:00:00 2001 From: Ivan Golikov Date: Sun, 15 Dec 2024 12:15:03 +0100 Subject: [PATCH] Small refactoring; fish, zoxide, git, difftastic installation --- .local/share/dotfiles/install_dev_tools.yml | 71 +++++++++++++-------- 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/.local/share/dotfiles/install_dev_tools.yml b/.local/share/dotfiles/install_dev_tools.yml index ab62c10..ece9533 100644 --- a/.local/share/dotfiles/install_dev_tools.yml +++ b/.local/share/dotfiles/install_dev_tools.yml @@ -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