Files
ansible-local/roles/shell/tasks/install_starship.yml
Phil Skentelbery e8d0f33c57 initial commit
2025-09-17 23:40:52 -06:00

42 lines
1.1 KiB
YAML

---
# Install Starship prompt (https://starship.rs/)
- name: Determine target user
ansible.builtin.set_fact:
shell_user: "{{ shell_user | default( lookup('env','USER') ) }}"
- name: Detect platform
ansible.builtin.set_fact:
is_macos: "{{ ansible_facts['os_family'] == 'Darwin' }}"
- name: Check if starship is already installed
ansible.builtin.command: which starship
register: starship_check
failed_when: false
changed_when: false
- name: Install Starship on macOS using Homebrew
community.general.homebrew:
name: starship
state: present
when: is_macos and starship_check.rc != 0
become: true
become_user: "{{ shell_user }}"
- name: Install Starship on Linux using official installer
ansible.builtin.shell: |
curl -fsSL https://starship.rs/install.sh | sh -s -- -y
args:
executable: /bin/bash
when: not is_macos and starship_check.rc != 0
become: true
- name: Ensure starship is in PATH
ansible.builtin.command: which starship
register: starship_check_after
failed_when: false
changed_when: false
- name: Print starship path
ansible.builtin.debug:
msg: "starship path: {{ starship_check_after.stdout }}"