diff --git a/tasks/main.yml b/tasks/main.yml index 683a059..ad83377 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -7,17 +7,20 @@ dest: "{{ rc_files_user_path }}/.oh-my-zsh/custom/themes/powerlevel10k" depth: 1 -- name: Merge zshrc lines - set_fact: - zshrc_lines: "{{ default_zshrc_lines + (extra_zshrc_lines | default([])) }}" +- name: Install .ansible_zshrc + template: + src: ansible_zshrc.j2 + dest: "{{ rc_files_user_path }}/.ansible_zshrc" + owner: root + group: root + mode: u=rw,g=r,o=r -- name: Install .zshrc +- name: Add source to .zshrc lineinfile: path: '~/.zshrc' - line: '{{ item }}' + line: "source .ansible_zshrc" create: yes mode: 'u=rw,go=r' - loop: "{{ zshrc_lines }}" - name: Install .p10k.zsh ansible.builtin.copy: diff --git a/templates/ansible_zshrc.j2 b/templates/ansible_zshrc.j2 new file mode 100644 index 0000000..cee86b6 --- /dev/null +++ b/templates/ansible_zshrc.j2 @@ -0,0 +1,11 @@ +# {{ ansible_managed }} + +# Default +{% for item in default_zshrc_lines %} +{{ item }} +{% endfor %} + +# Extra +{% for item in extra_zshrc_lines %} +{{ item }} +{% endfor %} \ No newline at end of file