1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #12687 from nitzmahone/pywinrm_arg_passthru

Force SSL transport for pywinrm updates, get host+group vars
This commit is contained in:
Brian Coca 2015-11-17 11:14:19 -08:00
commit aa55db69fe

View file

@ -46,6 +46,7 @@ from ansible.errors import AnsibleFileNotFound
from ansible.plugins.connection import ConnectionBase
from ansible.utils.path import makedirs_safe
from ansible.utils.unicode import to_bytes, to_unicode, to_str
from ansible.utils.vars import combine_vars
try:
from __main__ import display
@ -81,7 +82,7 @@ class Connection(ConnectionBase):
'''
Override WinRM-specific options from host variables.
'''
host_vars = host.get_vars()
host_vars = combine_vars(host.get_group_vars(), host.get_vars())
self._winrm_host = self._play_context.remote_addr
self._winrm_port = int(self._play_context.port or 5986)
@ -96,10 +97,12 @@ class Connection(ConnectionBase):
self._winrm_realm = None
self._winrm_realm = host_vars.get('ansible_winrm_realm', self._winrm_realm) or None
transport_selector = 'ssl' if self._winrm_scheme == 'https' else 'plaintext'
if HAVE_KERBEROS and ('@' in self._winrm_user or self._winrm_realm):
self._winrm_transport = 'kerberos,plaintext'
self._winrm_transport = 'kerberos,%s' % transport_selector
else:
self._winrm_transport = 'plaintext'
self._winrm_transport = transport_selector
self._winrm_transport = host_vars.get('ansible_winrm_transport', self._winrm_transport)
if isinstance(self._winrm_transport, basestring):
self._winrm_transport = [x.strip() for x in self._winrm_transport.split(',') if x.strip()]