You need to use the special variable called ansible_host to indicate the IP
address of the host, instead of using inventory_hostname.

inventory_hostname is an internally calculated variable, as such Ansible
doesn't use it from any external source.

On Tue, May 7, 2019 at 4:15 AM <[email protected]> wrote:

>
> i have a dynamic inventory script which outputs the following.
>
> "NODE_A": {
>         "inventory_hostname": "10.0.2.6",
>         "inventory_lparname": "NODE_A"
> }
>
> the nodes are not resolvable via dns or something as this network is some
> kind of isolated "management" lan.
> until now i had a play running which modifies the local /etc/hosts file to
> enable name resolution. as the ansible controller is going to move to an
> foreign machine, this is not possible anymore.
> so the big question is how to proceed. how do i instruct ansible to
> connect to the ip adress instead of the hostname repectively can i use
> inventory_hostname instead of ansible_hostname as connection string, but
> keep the hostname displayed in the play recap?
>
>
>
> chris
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/a43bbe88-1948-4a0f-9ec3-8fec7f5d0d0e%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/a43bbe88-1948-4a0f-9ec3-8fec7f5d0d0e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Matt Martz
@sivel
sivel.net

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v-wS1uC0x%3DnZhwRKmpurxo5cSfpRC3iWfGBhvGzhK%2BzAw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to