74 lines
2.4 KiB
YAML
74 lines
2.4 KiB
YAML
---
|
|
- name: Install modern CLI packages
|
|
ansible.builtin.apt:
|
|
name: "{{ pi_modern_shell_env_packages }}"
|
|
state: present
|
|
update_cache: true
|
|
|
|
- name: Symlink fdfind to fd
|
|
ansible.builtin.file:
|
|
src: /usr/bin/fdfind
|
|
dest: /usr/local/bin/fd
|
|
state: link
|
|
|
|
- name: Symlink batcat to bat
|
|
ansible.builtin.file:
|
|
src: /usr/bin/batcat
|
|
dest: /usr/local/bin/bat
|
|
state: link
|
|
|
|
- name: Download oh-my-posh binary
|
|
ansible.builtin.get_url:
|
|
# The official install script's own curl-based downloads are blocked by
|
|
# oh-my-posh's CDN on some devices (observed on Raspberry Pi OS's curl
|
|
# build: TLS handshake fails with SSL_ERROR_SYSCALL), while Ansible's
|
|
# get_url (Python urllib) succeeds against the same CDN. Download the
|
|
# binary directly instead of shelling out to the install script.
|
|
url: "https://cdn.ohmyposh.dev/releases/latest/posh-linux-{{ pi_modern_shell_env_ohmyposh_arch_map[ansible_architecture] }}"
|
|
dest: /usr/local/bin/oh-my-posh
|
|
mode: "0755"
|
|
|
|
- name: Determine target user's home directory
|
|
ansible.builtin.set_fact:
|
|
pi_modern_shell_env_target_home: "{{ '/root' if pi_modern_shell_env_target_user == 'root' else '/home/' + pi_modern_shell_env_target_user }}"
|
|
|
|
- name: Ensure config directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ pi_modern_shell_env_target_home }}/.config"
|
|
state: directory
|
|
owner: "{{ pi_modern_shell_env_target_user }}"
|
|
mode: "0700"
|
|
|
|
- name: Deploy oh-my-posh theme
|
|
ansible.builtin.copy:
|
|
src: ohmyposh.json
|
|
dest: "{{ pi_modern_shell_env_target_home }}/.config/ohmyposh.json"
|
|
owner: "{{ pi_modern_shell_env_target_user }}"
|
|
mode: "0644"
|
|
|
|
- name: Ensure fish config directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ pi_modern_shell_env_target_home }}/.config/fish"
|
|
state: directory
|
|
owner: "{{ pi_modern_shell_env_target_user }}"
|
|
mode: "0700"
|
|
|
|
- name: Deploy fish config
|
|
ansible.builtin.template:
|
|
src: config.fish.j2
|
|
dest: "{{ pi_modern_shell_env_target_home }}/.config/fish/config.fish"
|
|
owner: "{{ pi_modern_shell_env_target_user }}"
|
|
mode: "0644"
|
|
|
|
- name: Ensure fish is a known login shell
|
|
ansible.builtin.lineinfile:
|
|
path: /etc/shells
|
|
line: /usr/bin/fish
|
|
state: present
|
|
|
|
- name: Set fish as the default login shell
|
|
ansible.builtin.user:
|
|
name: "{{ pi_modern_shell_env_target_user }}"
|
|
shell: /usr/bin/fish
|
|
when: pi_modern_shell_env_set_default_shell
|