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
pull/21625/head
Peter Sprygada 8 years ago committed by GitHub
parent e05b2b56f2
commit e6dfbf63f6

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

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

Loading…
Cancel
Save