zzet / rbenv

Ansible role for installing rbenv.
https://galaxy.ansible.com/zzet/rbenv/
188 stars 112 forks source link

Request: Do not use nested variables #87

Open koenpunt opened 7 years ago

koenpunt commented 7 years ago

Now everyone that wants to customise a single option, they have to define the full hash.

With the defaults like:

  rbenv:
    env: system
    version: v1.0.0
    default_ruby: 2.3.3

Just setting the default_ruby requires me to define the full hash, e.g.:

- role: rbenv
  rbenv:
    env: system
    version: v1.0.0
    default_ruby: 2.1.6

And now since 3.0.0 the rubies properties is added, which requires me to add that to my playbook configuration (or add a version constraint).

There a way to get this working by setting hash_behaviour, but this isn't recommended:

We generally recommend not using this setting unless you think you have an absolute need for it, and playbooks in the official examples repos do not use this setting:

So I suggest to change it to plain variables:

  rbenv_env: system
  rbenv_version: v1.0.0
  rbenv_default_ruby: 2.3.3
  rbenv_rubies:
    - version: 2.3.3
RossBarnie commented 6 years ago

In a role to install and configure Icinga2, we've made the decision to keep certain variables in a hash and came up agains the same issues regarding variables as hash getting overwritten. We solved this using the combine filter and setting the default values under vars in the role, see https://github.com/Icinga/ansible-icinga2/commit/0fd8afea4ff807eda5c2d3b51f98eea509150bfa. May or may not be suitable here.

AndrewKvalheim commented 1 year ago

Related: #89, #150