Skip to content
This repository has been archived by the owner on Jul 8, 2021. It is now read-only.

Fix undefined ansible_ssh_user #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

davidkuridza
Copy link

When ansible_ssh_user is not configured, task "Create users" fails with
message "'ansible_ssh_user' is undefined". To avoid it, a simple
fallback to the $USER environment variable is made.

When ansible_ssh_user is not configured, task "Create users" fails with
message "'ansible_ssh_user' is undefined". To avoid it, a simple
fallback to the `$USER` environment variable is made.
@mattwillsher
Copy link
Member

This is a bit of a sticky issue - really the call wants to know the remote user that's being used for the Ansible call. If I'm understanding correctly, this call will lookup the user on the client.

@davidkuridza
Copy link
Author

Correct. I'm new to Ansible and after some googling, this was the proposed solution. I have no problems changing the code if needed, can you point me in the right direction?

@mattwillsher
Copy link
Member

I don't know the best approach. I looked at this a while ago and came up
blank. Perhaps something that checks the remote env vars for the user name
of the incoming user and registers it as a fact?

On 24 August 2016 at 17:37:33, David Kuridža ([email protected])
wrote:

Correct. I'm new to Ansible and after some googling, this was the proposed
solution. I have no problems changing the code if needed, can you point me
in the right direction?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#8 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABghu-Nvm24IQNNFZuW1c987GrxaWXPEks5qjHNNgaJpZM4JrNun
.

@davidkuridza
Copy link
Author

I've taken a second to think about this from a different perspective. Is it necessary to have item.name == ansible_ssh_user there as a condition at all? Isn't a check for item.state == 'absent' enough?

@mattwillsher
Copy link
Member

It's their to stop an attempt to remove the user ansible is logged in as.
Removing the Ansible login user fails because the underlying system stop
removal of active users. ansible_ssh_user (or ansible_user as it's known in
recent Ansible versions) used to contain the user name or the remote end
but no longer does so reliably.

On 25 August 2016 at 12:48:29, David Kuridža ([email protected])
wrote:

I've taken a second to think about this from a different perspective. Is
it necessary to have item.name == ansible_ssh_user there as a condition
at all? Isn't a check for item.state == 'absent' enough?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#8 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABghu-0-zkdQZmgOzXumEseE81IT2oDNks5qjYENgaJpZM4JrNun
.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants