Add default: True role variable to ensure NVM default alias is set correctly
morgangraphics opened this issue · 0 comments
As described in this PR comment
To sum it up, perhaps what you are suggesting is that there should be a new role variable that is something like: default: True
so whichever version you explicitly state, is aliased as the default NodeJS version to run. All this would do is append/concatenate the nvm alias default {{ nodejs_version }}
command to the {{ nvm_commands }}
list making the version explicitly declared as the default, mitigating the need for a separate one off "nvm use {{ nodejs_version }}
task. (It'd just make it more generic using already existing stuff) e.g.
- hosts: host1
roles:
- role: ansible-role-nvm
nodejs_version: "10.15.1"
default: True
- hosts: host1
roles:
- role: ansible-role-nvm
nodejs_version: "8.15.0"
The added benefit is that if there are other versions on the machine that you want to leverage, you could then take advantage of the nvm_commands: []
role variable itself. This brings me to the other point of having to update the documentation to explain the nvm_commands: []
variable in further detail.