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
166 stars 42 forks source link

`users` variable name too generic #58

Closed ryayon closed 6 years ago

ryayon commented 6 years ago

Hi,

The users variable name is too generic as it can be used by different other roles. Would you mind set it to a more specific name such as oh_my_zsh_users (I took it from others of your variables). If you need me to do a PR, just let me know.

Regards, Rudy

freemanjp commented 6 years ago

Thanks for the feedback.

I admit this breaks the rule that all role variables should have a unique name (e.g. prefixed with the role name), but I'd argue user specific configuration is a special case. All the GantSign roles (and many other third party roles) put user specific configuration under users to allow you to group the user specific configuration: e.g.

- hosts: all
  vars:
    users:
      - username: example1
        oh_my_zsh:
          theme: robbyrussell
          plugins:
            - git
        another_ansible_role1: config1
        another_ansible_role2: config2
  roles:
    - role: gantsign.oh-my-zsh
    - role: another_ansible_role1
    - role: another_ansible_role2

The role specific configuration is still under a separate namespaces (oh_my_zsh for this role).

If this causes you a problem put the configuration directly under the role and then it won't clash with any other roles:

- hosts: all
  roles:
    - role: gantsign.oh-my-zsh
      users:
        - username: example1
          oh_my_zsh:
            theme: robbyrussell
            plugins:
              - git

Changing users to oh_my_zsh_users would prevent us grouping user specific configuration (as in the first example above) but not improve over putting the configuration under the role (as in the second example).

I expect the following would work if you need to define the user specific configuration outside the role under a different name:

- hosts: all
  vars:
    oh_my_zsh_users:
      - username: example1
        oh_my_zsh:
          theme: robbyrussell
          plugins:
            - git
  roles:
    - role: gantsign.oh-my-zsh
      users: '{{ oh_my_zsh_users }}'

I'd also be concerned about breaking backwards compatibility and consistency with other GantSign roles.

Does the above explanation resolve your concerns or is there a another problem I haven't seen?