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.