Hello,
I’m trying to invoke the copy action plugin with a timestamp var. Here is the code:
def copy(self, task_vars):
new_task = self._task.copy()
new_task.args.update(
dict(
src="/etc/systemd/network/",
dest="/etc/systemd/network_backup_{{ timestamp }}",
remote_src=True,
),
)
print(f"new_task={new_task}")
copy_action = self._shared_loader_obj.action_loader.get('copy',
task=new_task,
connection=self._connection,
play_context=self._play_context,
loader=self._loader,
templar=self._templar,
shared_loader_obj=self._shared_loader_obj)
ret = dict()
task_vars.update(dict(timestamp="foo"))
ret.update(copy_action.run(task_vars=task_vars))
print(f"copy action ret = {ret}")
I would like the var timestamp
to be replaced with foo. Is possible with ansible vars? Or do I need to perform the lookup/replace by hand?
Regards
Yves