Skip to content

Commit e540c5d

Browse files
committedSep 21, 2024
fix zsh
1 parent 3d4c493 commit e540c5d

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed
 

‎ansible/playbooks/zsh.yml

+32-32
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
user: "{{ ansible_user }}"
88

99
tasks:
10-
1110
- name: Install necessary packages
1211
apt:
1312
name:
@@ -17,10 +16,34 @@
1716
state: present
1817
update_cache: yes
1918

20-
- name: Change default shell to Zsh
21-
user:
22-
name: "{{ user }}"
23-
shell: /bin/zsh
19+
- name: Pre-create basic .zshrc to avoid the zsh-newuser-install prompt
20+
copy:
21+
dest: "/home/{{ user }}/.zshrc"
22+
content: |
23+
# Basic .zshrc to prevent zsh-newuser-install prompt
24+
# Path to your Oh My Zsh installation.
25+
export ZSH="$HOME/.oh-my-zsh"
26+
export PATH=$PATH:$HOME/.local/bin
27+
28+
# Set theme
29+
ZSH_THEME="robbyrussell"
30+
31+
# Plugins
32+
plugins=(git ubuntu copypath copyfile dirhistory zsh-interactive-cd docker docker-compose opentofu zsh-history-substring-search zsh-autosuggestions zsh-syntax-highlighting you-should-use)
33+
34+
source $ZSH/oh-my-zsh.sh
35+
36+
# Set up Oh My Posh
37+
eval "$(oh-my-posh init zsh --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/sonicboom_dark.omp.json)"
38+
39+
# Custom aliases
40+
alias dcd="docker compose down"
41+
alias dcu="docker compose up -d"
42+
43+
# Display system information
44+
neofetch
45+
owner: "{{ user }}"
46+
mode: '0644'
2447

2548
- name: Install Oh My Zsh (unattended)
2649
shell: |
@@ -72,30 +95,7 @@
7295
owner: "{{ user }}"
7396
mode: '0755'
7497

75-
- name: Set up custom .zshrc
76-
copy:
77-
dest: "/home/{{ user }}/.zshrc"
78-
content: |
79-
# Path to your Oh My Zsh installation.
80-
export ZSH="$HOME/.oh-my-zsh"
81-
export PATH=$PATH:$HOME/.local/bin
82-
83-
# Set theme
84-
ZSH_THEME="robbyrussell"
85-
86-
# Plugins
87-
plugins=(git ubuntu copypath copyfile dirhistory zsh-interactive-cd docker docker-compose opentofu zsh-history-substring-search zsh-autosuggestions zsh-syntax-highlighting you-should-use)
88-
89-
source $ZSH/oh-my-zsh.sh
90-
91-
# Set up Oh My Posh
92-
eval "$(oh-my-posh init zsh --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/sonicboom_dark.omp.json)"
93-
94-
# Custom aliases
95-
alias dcd="docker compose down"
96-
alias dcu="docker compose up -d"
97-
98-
# Display system information
99-
neofetch
100-
owner: "{{ user }}"
101-
mode: '0644'
98+
- name: Change default shell to Zsh (after setting up .zshrc)
99+
user:
100+
name: "{{ user }}"
101+
shell: /bin/zsh

0 commit comments

Comments
 (0)
Please sign in to comment.