Modern tools (rg, fd...)
This commit is contained in:
59
roles/pi_modern_shell_env/tasks/main.yml
Normal file
59
roles/pi_modern_shell_env/tasks/main.yml
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
- 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 starship install script
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ pi_modern_shell_env_starship_install_url }}"
|
||||
dest: /tmp/starship-install.sh
|
||||
mode: "0755"
|
||||
|
||||
- name: Run starship install script
|
||||
ansible.builtin.command:
|
||||
cmd: /tmp/starship-install.sh --yes
|
||||
creates: /usr/local/bin/starship
|
||||
|
||||
- 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 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
|
||||
Reference in New Issue
Block a user