Skip to content

Commit e288f2f

Browse files
committed
fix: Oh My Zsh installation failures
- Make dotfiles role conditional to prevent bootstrap crash - Check for oh-my-zsh.sh file instead of directory - Unset ZSH variable to allow installer to run
1 parent 4b9e530 commit e288f2f

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

setup.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,19 @@
276276
- dotfiles
277277
- configuration
278278
- always
279+
- name: Check if dotfiles directory exists
280+
ansible.builtin.stat:
281+
path: "{{ playbook_dir }}/dotfiles"
282+
register: dotfiles_dir_check
283+
tags:
284+
- dotfiles
285+
- configuration
286+
- always
287+
279288
- name: Include dotfiles role
280289
ansible.builtin.include_role:
281290
name: dotfiles
291+
when: dotfiles_dir_check.stat.exists
282292
tags:
283293
- dotfiles
284294
- configuration
@@ -386,16 +396,15 @@
386396
- dev-tools
387397
- name: Check Oh My Zsh installation
388398
ansible.builtin.stat:
389-
path: '{{ home }}/.oh-my-zsh'
399+
path: '{{ home }}/.oh-my-zsh/oh-my-zsh.sh'
390400
register: ohmyzsh_check
391401
tags:
392402
- always
393403
- shell
394404
- name: Install Oh My Zsh
395-
ansible.builtin.shell: >
396-
sh -c "$(curl -fsSL
397-
https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/
398-
tools/install.sh)" "" --unattended
405+
ansible.builtin.shell: |
406+
curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -o /tmp/install-oh-my-zsh.sh
407+
env -u ZSH RUNZSH=no sh /tmp/install-oh-my-zsh.sh --unattended
399408
register: ohmyzsh_install
400409
when:
401410
- not ohmyzsh_check.stat.exists

0 commit comments

Comments
 (0)