-
Notifications
You must be signed in to change notification settings - Fork 23.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'ansible_user' is undefined #23530
Comments
This isn't a bug. In the absence of a specified user, either by |
i see your point, but the same command |
The behaviour change for debug was not intended, but also not something we are looking at. Also note that 'debug' has no connection as it is a special action that does not require one, like add_hosts, group_by, pause, etc. These are actions that affect the data or display of Ansible itself, not the target hosts. |
its not only happening in the
|
@bcoca : I Agree with @mhristof here. If nothing is set, we expect this to be from the env. Here it just fails. Either we need a doc change, or a change the behavior. |
I'm starting to see this creeping in from a lot of different places actually—I've been getting some error reports in certain environments where playbooks were working great and all the sudden are not, and I just experienced it in some of my Travis CI builds, where I'm getting See some excellent sleuthing by @oxyc here: geerlingguy/drupal-vm#1302 (comment) Basically, I have to ask... if we can't use I haven't had an issue from 2.0 -> 2.2.x, but now that 2.3.0 is here it pops up in some environments but not others. |
Additionally, if I pass something like |
@geerlingguy we started to move to ansible_user_id, but hell who know's what's going to happen on next release. |
I suspect the break came here 58ee661 |
I would say ansible_user can potentially be none (there is no builtin default but usually remote_user ansible_ssh_user etc provide it) for the reasons @nitzmahone mentioned. for the case here
It seems like it is a bug that is not being set. |
reverting the commit above 'fixes it' |
This reverts commit 58ee661. fixes ansible#23530
@geerlingguy asked an excellent question, and I want to repeat it, because I am also seeking an answer:
How can I refer to the user who is running the ansible playbook??? |
|
@nitzmahone - Thanks, that seems to work for me! |
In addition to
You get the below error:
I even tried using BTW, with
I get this error:
|
Another workaround is to use |
@haridsv I tried your workaround to install the package
But I got this error about missing file permission
|
@edesz You are trying to install system package as a regular user, which is why you are seeing the permissions issues. What is the error you are trying to workaround? |
You are right. That could be it. My issue was about undefined variable
I got the same error as in the OP here that After searching through Google I came to this issue and I thought your workaround might have worked. That was my reason for trying it and posting here about it. But your are right....my problem is likely due to running as a regular user. |
@edesz Right, you should be able to get past this error by just removing |
ISSUE TYPE
COMPONENT NAME
ansible
ANSIBLE VERSION
CONFIGURATION
vanilla vagrant box, ubuntu/xenial64
OS / ENVIRONMENT
Only tested ubuntu/xenial64
SUMMARY
ansible_user
seems to be undefined.STEPS TO REPRODUCE
Just fire up a vagrant box, install ansible via pip and check the ansible_user
EXPECTED RESULTS
ACTUAL RESULTS
This works on 2.2.0.0
The text was updated successfully, but these errors were encountered: