summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2018-12-09 18:41:06 +0100
committerGuilhem Moulin <guilhem@fripost.org>2018-12-09 20:25:40 +0100
commite2ddcfc51f66c2a52a401064eab005e793f148ee (patch)
tree7c14243b2d53f81e54c9ee77dc526c71559e572a /lib
parent7d9380c2c9dd87876ce4d9f9b30c934505fcba51 (diff)
Update 'IMAP', 'MSA' and 'LDAP-provider' roles to Debian Stretch.
Diffstat (limited to 'lib')
-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