connection=autolocal

52 views
Skip to first unread message

anatoly techtonik

unread,
Mar 28, 2014, 6:49:10 AM3/28/14
to ansible...@googlegroups.com
Is it possible to define host in inventory in a way that will use local connection is the name resolves to local address?

Is it worth to add connection=autolocal option?

Michael DeHaan

unread,
Mar 28, 2014, 9:37:44 AM3/28/14
to ansible...@googlegroups.com
We would not be taking a pull request for a new connection option.

However, if you want to make sure the localhost if in the host file is always local:

localhost ansible_connection=local

(*Further*, Ansible now has "implicit localhost" capabilities so localhost doesn't have to be in inventory in most cases, and if not there and referenced, it is assumed to be a local connection)



On Fri, Mar 28, 2014 at 6:49 AM, anatoly techtonik <tech...@gmail.com> wrote:
Is it possible to define host in inventory in a way that will use local connection is the name resolves to local address?

Is it worth to add connection=autolocal option?

--
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/a079f99e-92c6-4e6c-b012-d0be219437a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

anatoly techtonik

unread,
Mar 29, 2014, 1:49:05 AM3/29/14
to ansible...@googlegroups.com
On Fri, Mar 28, 2014 at 4:37 PM, Michael DeHaan <mic...@ansible.com> wrote:
> We would not be taking a pull request for a new connection option.
>
> However, if you want to make sure the localhost if in the host file is
> always local:

No. I want to make connection to host "yetanothernode" local only if I execute
playbook on this host itself. If I execute playbook for this host from other
machine, I want it to connect to "yetanothernode" by SSH as usual.

The problem can also be generalized for nodes inside subnetwork, where
node see each other by local IPs (or local protocol) and should connect
using custom connection if some condition is met. If condition is not met,
we assume to be outside the network and fall down to standard connection
type.

Michael DeHaan

unread,
Mar 30, 2014, 6:18:24 PM3/30/14
to ansible...@googlegroups.com
Hmmm, this would require some games to figure out if the hostname in the playbook matched what the local machine was saying it was.

I'm inclined to say no to this, and it can be greatly simplified by even allowing the machine to be managed locally over SSH if you want - - if localhost is not special.

Generally most people are designing a node for management purposes rather than running Ansible from one of the nodes in a cluster, etc, so I can't see this being a very common use case.

Perhaps I'm misunderstanding though.




--
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.
Reply all
Reply to author
Forward
0 new messages