Skip to content

Commit 6620a53

Browse files
committedSep 22, 2024
test zsh playbook
1 parent 45d9404 commit 6620a53

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed
 

‎ansible/playbooks/zsh.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
state: present
1717
update_cache: yes
1818

19-
- name: Pre-create basic .zshrc to avoid the zsh-newuser-install prompt
19+
- name: Pre-create basic .zshrc
2020
copy:
2121
dest: "/home/{{ user }}/.zshrc"
2222
content: |
@@ -45,14 +45,19 @@
4545
owner: "{{ user }}"
4646
mode: '0644'
4747

48-
- name: Install Oh My Zsh (unattended)
49-
shell: |
50-
RUNZSH=no sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
51-
environment:
52-
HOME: "/home/{{ user }}"
48+
- name: Download Oh My Zsh installation script
49+
get_url:
50+
url: https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
51+
dest: /tmp/install_ohmyzsh.sh
52+
53+
- name: Run Oh My Zsh installation script
54+
command: sh /tmp/install_ohmyzsh.sh --unattended
55+
register: ohmyzsh_result
56+
failed_when: "'FAILED' in ohmyzsh_result.stderr"
5357
args:
5458
chdir: "/home/{{ user }}"
55-
creates: "/home/{{ user }}/.oh-my-zsh"
59+
environment:
60+
HOME: "/home/{{ user }}"
5661

5762
- name: Ensure custom plugins directory exists
5863
file:
@@ -64,25 +69,25 @@
6469
- name: Clone zsh-syntax-highlighting plugin
6570
git:
6671
repo: https://github.com/zsh-users/zsh-syntax-highlighting.git
67-
dest: "/home/{{ ansible_user }}/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting"
72+
dest: "{{ zsh_custom }}/plugins/zsh-syntax-highlighting"
6873
update: yes
6974

7075
- name: Clone zsh-autosuggestions plugin
7176
git:
7277
repo: https://github.com/zsh-users/zsh-autosuggestions.git
73-
dest: "/home/{{ ansible_user }}/.oh-my-zsh/custom/plugins/zsh-autosuggestions"
78+
dest: "{{ zsh_custom }}/plugins/zsh-autosuggestions"
7479
update: yes
7580

7681
- name: Clone zsh-history-substring-search plugin
7782
git:
7883
repo: https://github.com/zsh-users/zsh-history-substring-search.git
79-
dest: "/home/{{ ansible_user }}/.oh-my-zsh/custom/plugins/zsh-history-substring-search"
84+
dest: "{{ zsh_custom }}/plugins/zsh-history-substring-search"
8085
update: yes
8186

8287
- name: Clone you-should-use plugin
8388
git:
8489
repo: https://github.com/MichaelAquilina/zsh-you-should-use.git
85-
dest: "/home/{{ ansible_user }}/.oh-my-zsh/custom/plugins/you-should-use"
90+
dest: "{{ zsh_custom }}/plugins/you-should-use"
8691
update: yes
8792

8893
- name: Ensure .local/bin directory exists

0 commit comments

Comments
 (0)
Please sign in to comment.