Open decentral1se opened 1 month ago
Hey @decentral1se ! Yeah I can see how it might not be handling edge cases properly with half-ran envs etc. It would be more idempotent had we have a variable registered that denotes whether the installation ran or not at all.
Can you put this before the installation step
- name: Probe the env for the nvm binary
shell: which nvm || echo "nvm missing"
register: nvm_probe
and then augment the install step with
when: nvm_installation_script_template is defined and (nvm_installation_script_template.changed or nvm_probe.stdout == "nvm missing")
EDIT: tweaked the when:
part for more sense
https://github.com/grzegorznowak/ansible-nvm-node/blob/c9f1a77538178644b3fdabe2f4b41a07eebf6806/tasks/main.yml#L19-L24
I saw a case where the script was put in place but for some reason didn't run the install (maybe ctrl-c was the culprit during runtime) and then on 2nd run, it failed at the symlink task because it never ran the script.