fixes eos action mapping of play_context values (#21614)

* adds mapping for ssh_keyfile
* adds correct mappings for eapi
* fixes missing no_log value for provider arg
This commit is contained in:
Peter Sprygada 2017-02-18 09:29:06 -05:00 committed by GitHub
parent e05b2b56f2
commit e6dfbf63f6
2 changed files with 15 additions and 13 deletions

View file

@ -57,7 +57,7 @@ eos_argument_spec = {
'validate_certs': dict(type='bool'), 'validate_certs': dict(type='bool'),
'timeout': dict(type='int'), 'timeout': dict(type='int'),
'provider': dict(type='dict'), 'provider': dict(type='dict', no_log=True),
'transport': dict(choices=['cli', 'eapi']) 'transport': dict(choices=['cli', 'eapi'])
} }

View file

@ -58,6 +58,8 @@ class ActionModule(_ActionModule):
pc.network_os = 'eos' pc.network_os = 'eos'
pc.remote_user = provider['username'] or self._play_context.connection_user pc.remote_user = provider['username'] or self._play_context.connection_user
pc.password = provider['password'] or self._play_context.password or 22 pc.password = provider['password'] or self._play_context.password or 22
pc.privateip_key_file = provider['ssh_keyfile'] or self._play_context.private_key_file
pc.timeout = provider['timeout'] or self._play_context.timeout
pc.become = provider['authorize'] or False pc.become = provider['authorize'] or False
pc.become_pass = provider['auth_pass'] pc.become_pass = provider['auth_pass']
@ -73,18 +75,18 @@ class ActionModule(_ActionModule):
task_vars['ansible_socket'] = socket_path task_vars['ansible_socket'] = socket_path
else: else:
if provider['host'] is None: provider_arg = {
self._task.args['host'] = self._play_context.remote_addr 'host': provider.get('host') or self._play_context.remote_addr,
if provider['username'] is None: 'port': provider.get('port'),
self._task.args['username'] = self._play_context.connection_user 'username': provider.get('username') or self._play_context.connection_user,
if provider['password'] is None: 'password': provider.get('password') or self._play_context.password,
self._task.args['password'] = self._play_context.password 'authorize': provider.get('authorize') or False,
if provider['timeout'] is None: 'auth_pass': provider.get('auth_pass'),
self._task.args['timeout'] = self._play_context.timeout 'timeout': provider.get('timeout') or self._play_context.timeout,
if task_vars.get('eapi_use_ssl'): 'use_ssl': task_vars.get('eapi_use_ssl') or False,
self._task.args['use_ssl'] = task_vars['eapi_use_ssl'] 'validate_certs': task_vars.get('eapi_validate_certs') or True
if task_vars.get('eapi_validate_certs'): }
self._task.args['validate_certs'] = task_vars['eapi_validate_certs'] self._task.args['provider'] = provider_arg
if self._play_context.become_method == 'enable': if self._play_context.become_method == 'enable':
self._play_context.become = False self._play_context.become = False