From 8a684a8c35325e413fb161c78a16e851f2432ceb Mon Sep 17 00:00:00 2001 From: Ziwi Date: Tue, 27 Aug 2024 23:17:09 +0200 Subject: [PATCH] fix(zshrc): Ensure proper PATH is propagated in zshrc in case installation fails before config part --- ansible/roles/config/templates/zshrc.j2 | 1 - ansible/roles/software/tasks/zsh.yml | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ansible/roles/config/templates/zshrc.j2 b/ansible/roles/config/templates/zshrc.j2 index 3f62c5f..8a31197 100644 --- a/ansible/roles/config/templates/zshrc.j2 +++ b/ansible/roles/config/templates/zshrc.j2 @@ -6,7 +6,6 @@ if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]] fi # If you come from bash you might have to change your $PATH. -#export PATH=$HOME/.local/bin:$HOME/bin:/usr/local/bin:$PATH export PATH=$PATH:$HOME/.local/bin:$HOME/bin:/usr/local/bin # Path to your oh-my-zsh installation. diff --git a/ansible/roles/software/tasks/zsh.yml b/ansible/roles/software/tasks/zsh.yml index 0ef87f3..8823711 100644 --- a/ansible/roles/software/tasks/zsh.yml +++ b/ansible/roles/software/tasks/zsh.yml @@ -38,6 +38,12 @@ changed_when: not ohmyzsh.stat.exists when: not ohmyzsh.stat.exists +- name: '[Zsh] Esnure ~/.loca/bin is added to PATH' + ansible.builtin.lineinfile: + path: "{{ ansible_env.HOME }}/.zshrc" + regexp: '^.*\.local/bin.*$' + line: 'export PATH=$PATH:$HOME/.local/bin:$HOME/bin:/usr/local/bin' + - name: "[Zsh] Plugins install/update" ansible.builtin.git: repo: "{{ item.value }}"