gantsign / ansible-role-oh-my-zsh

Ansible role for installing and configuring oh-my-zsh
https://galaxy.ansible.com/gantsign/oh-my-zsh
MIT License
165 stars 41 forks source link

Customising .zshrc #119

Closed hawksight closed 3 years ago

hawksight commented 3 years ago

Thank you for this role, really nice and easy to use. I did try the antigen one but I'm not familiar with it just yet and it failed on macOS which is what I'm targetting mainly.

So I would like to add custom content to the .zshrc file but at the moment the jinja file doesn't support adding custom snippets. I can of course override in subsequent plays / roles but it doesn't feel very ansible like to do that.

I've got two options in my head and which would be best based on your experience:

1) A variable to enable custom content and embed added content within that and append at the end of the .zshrc file.

# oh_my_zsh_zshrc_custom: ""
oh_my_zsh_zshrc_custom: |
  <insert script content here>

Eg. append at end of current template:

# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

{{ oh_my_zsh_zshrc_custom }}

2) Allow user to supply own jinja template as an input

# oh_my_zsh_zshrc_custom_template: ""
oh_my_zsh_zshrc_custom_template: "{{ playbook_dir}}/templates/my_zshrc.j2"

3) Maybe I'm missing the point and should be providing custom config in another location that will automatically get included?

Happy to do a PR if you think either of those options would be useful?

[EDIT] - Just seen this: https://github.com/gantsign/ansible-role-oh-my-zsh/issues/89

Also I realised that adding scripts to the ~/.oh-my-zsh/custom directory get included by default. I was able to configure another role to output it's zsh config to a file there and it works.

freemanjp commented 3 years ago

@hawksight as stated in #89 (which you mentioned), #114 and #116, I won't be accepting a change to allow additional customization of the .zshrc.

I'm glad you've found a suitable workaround.

hawksight commented 3 years ago

Thanks for responding @freemanjp. Understood and I will look more into antigen in the future. Closing this issue.