63 lines
1.5 KiB
YAML
63 lines
1.5 KiB
YAML
---
|
|
- hosts: all
|
|
vars:
|
|
common_packages:
|
|
- neovim
|
|
- ripgrep
|
|
- fd
|
|
- tree
|
|
- gcc
|
|
- fish
|
|
- zoxide
|
|
- git
|
|
- difftastic
|
|
|
|
brew_packages:
|
|
- pipx
|
|
|
|
pacman_packages:
|
|
- python-pipx
|
|
|
|
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' }}"
|
|
|
|
- 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: 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 %}"
|