Closed hakamine closed 4 years ago
Some background: having problems with the default('env', 'USER'))
assignment, it causes an error when the user in the ansible target machine is different from the one in the control machine (#66)
Any reason why this isn't merged yet?
With this change, there are four precedences for the "user". The highest priority is first:
This means, for instance, that nodejs_install_npm_user
will be used, if defined, regardless of other variables. If it's not defined, ansible checks to see if ansible_user_id
is defined, and so on.
Maybe combine the two tasks that set nodejs_install_npm_user
into one task? The two tasks are equivalent to:
Edit: fixed syntax
- name: Define nodejs_install_npm_user
set_fact:
nodejs_install_npm_user: "{{ ansible_user_id | default(ansible_user) | default(lookup('env', 'USER')) }}"
when: nodejs_install_npm_user is not defined
This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!
Please read this blog post to see the reasons why I mark pull requests as stale.
This pull request has been closed due to inactivity. If you feel this is in error, please reopen the pull request or file a new PR with the relevant details.
this is still relevant and very confusing. please merge the fix.
Run into the same problem here when using Packer
Fixed this by defining a var
vars:
nodejs_install_npm_user: "{{ ansible_user_id }}"
Recent ansible releases seem to use ansible_user_id instead of ansible_user. Set nodejs_install_npm_user to ansible_user_id if it exists.