summaryrefslogtreecommitdiffstats
path: root/lib/action_plugins/openldap.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/action_plugins/openldap.py')
-rw-r--r--lib/action_plugins/openldap.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/action_plugins/openldap.py b/lib/action_plugins/openldap.py
index ae4992a..b94a822 100644
--- a/lib/action_plugins/openldap.py
+++ b/lib/action_plugins/openldap.py
@@ -46,24 +46,27 @@ class ActionModule(ActionBase):
target = self._loader.path_dwim_relative(self._task._role._role_path, local+'s', target)
else:
target = self._loader.path_dwim_relative(self._loader.get_basedir(), local+'s', target)
remote_user = task_vars.get('ansible_ssh_user') or self._play_context.remote_user
new_module_args = self._task.args.copy()
new_module_args['target'] = self._connection._shell.join_path(self._make_tmp_path(remote_user), 'target.ldif')
new_module_args['local'] = 'no'
if local == 'template':
# template the source data locally
try:
with open(target, 'r') as f:
template_data = to_text(f.read())
target = self._templar.template(template_data, preserve_trailing_newlines=True, escape_backslashes=False, convert_data=False)
except Exception as e:
result['failed'] = True
result['msg'] = type(e).__name__ + ": " + str(e)
return result
- # transfer the file and run the module remotely
- self._transfer_data(new_module_args['target'], target)
+ # transfer the file and run the module remotely
+ self._transfer_data(new_module_args['target'], target)
+ elif local == 'file':
+ self._transfer_file(target, new_module_args['target'])
+
result.update(self._execute_module(module_args=new_module_args, task_vars=task_vars))
return result