setting ansible_connection=winrm overrides connection: local in play

294 views
Skip to first unread message

an...@change-inside.com

unread,
Mar 23, 2015, 2:39:14 PM3/23/15
to ansible...@googlegroups.com
We're using playbooks to bring up AWS infrastructure, then provision within the OS

This works fine for linux hosts, as we just use connection: local in the plays that do instance provisioning etc. and can bring hosts up according to inventory vars set for the individual hosts.

We're blocked when working with windows hosts at the moment though...
Setting ansible_connection=winrm in inventory seems to override subsequent attempts to use connection: local in a play.

Has anyone else seen this... any ideas how to get around it

Thanks,
Andy

DS Morse

unread,
Dec 16, 2016, 5:15:03 PM12/16/16
to Ansible Project
Yes I'm still seeing this error even with ansible 2.2.0  Once ansible_connection is set in the inventory, I can not override it in a playbook nor from the command line.  It feels like the inverse of the desired behavior as the closer settings are being ignored based on a config that is further away from the point of execution.

Brian Coca

unread,
Dec 16, 2016, 5:27:07 PM12/16/16
to ansible...@googlegroups.com
The host specific connection variables trump the general settings and directives, this is on purpose as the hosts can require specifics that plays are unaware of. That said, there are several ways  to override in command line and play.

I recommend using either `local_action` or `delegate_to: localhost` instead of `connection: local`, the latter does not override connection variables. 

Another way is to just set that variable `ansible_connection=local` on the command line or in the play, which will override the inventory setting.



--
----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages