remote_user temp

25 views
Skip to first unread message

DomaNitro

unread,
Oct 16, 2014, 12:16:32 PM10/16/14
to ansible...@googlegroups.com
Hi

We provision our servers in a cloud provider. The provider injects ssh keys and create a temp user for our initial connection.
We use that temp user  to provision the machine and then the temp user will be disabled.

So the next run for plays will fail because remote_user does not exist anymore.

Any ideas how we might tackle this in an automated way? 

Our goal is every person uses hes username

Michael Peters

unread,
Oct 16, 2014, 3:31:21 PM10/16/14
to ansible...@googlegroups.com
I have provisioning playbooks (AWS) that create the server. They then
use add_host to add it to the inventory.
When using add_host you can pass other variables along that act just
like host_vars that came from the inventory (AFAIK).
If you pass the ansible_ssh_user you can set the user that ansible
uses for the remainder of that play to access that
host.

You can also add the host to any applicable groups. This is where I
then do my boostrapping of the host and the application of it's
necessary roles.
Then when you run another playbook later, the host is now in the
dynamic inventory and picks up the new real username that works after
the bootstrapping has been applied.

There's probably other ways to do it, but that's worked pretty well so far.
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/b15d6d53-b9de-4737-ba3f-967b8d1111a0%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

DomaNitro

unread,
Oct 19, 2014, 11:03:26 AM10/19/14
to ansible...@googlegroups.com
Michel,


Perfect that solved the issue :)

Thanks
Reply all
Reply to author
Forward
0 new messages