|
16 | 16 | state: present
|
17 | 17 | update_cache: yes
|
18 | 18 |
|
19 |
| - - name: Pre-create basic .zshrc to avoid the zsh-newuser-install prompt |
| 19 | + - name: Pre-create basic .zshrc |
20 | 20 | copy:
|
21 | 21 | dest: "/home/{{ user }}/.zshrc"
|
22 | 22 | content: |
|
|
45 | 45 | owner: "{{ user }}"
|
46 | 46 | mode: '0644'
|
47 | 47 |
|
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" |
53 | 57 | args:
|
54 | 58 | chdir: "/home/{{ user }}"
|
55 |
| - creates: "/home/{{ user }}/.oh-my-zsh" |
| 59 | + environment: |
| 60 | + HOME: "/home/{{ user }}" |
56 | 61 |
|
57 | 62 | - name: Ensure custom plugins directory exists
|
58 | 63 | file:
|
|
64 | 69 | - name: Clone zsh-syntax-highlighting plugin
|
65 | 70 | git:
|
66 | 71 | 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" |
68 | 73 | update: yes
|
69 | 74 |
|
70 | 75 | - name: Clone zsh-autosuggestions plugin
|
71 | 76 | git:
|
72 | 77 | 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" |
74 | 79 | update: yes
|
75 | 80 |
|
76 | 81 | - name: Clone zsh-history-substring-search plugin
|
77 | 82 | git:
|
78 | 83 | 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" |
80 | 85 | update: yes
|
81 | 86 |
|
82 | 87 | - name: Clone you-should-use plugin
|
83 | 88 | git:
|
84 | 89 | 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" |
86 | 91 | update: yes
|
87 | 92 |
|
88 | 93 | - name: Ensure .local/bin directory exists
|
|
0 commit comments