Closed fthommen closed 2 years ago
Is there by chance any update @bcoca ?
The issue is you are working on the controller, so 'remote' setting is not going to work, you need to invoke ansible with the env var already set:
ANSIBLE_LOCAL_BACKUP=/tmp/mybackups ansible-playbook ...
Thanks @bcoca. It seems that I completely misunderstood what local_backup
does. It seems to create the backup files on the controller and not on the client. That's not what I tried to achieve. We would need the backup files to stay on the client, but in a dedicated (backup) directory tree and not in the original directory (to avoid clutter with sometimes hundreds of backup files). So I will probably have to look for an other solution.
@fthommen that is the reason we have not built this into Ansible itself, many different needs and requirements on what the backup location needs to be for people, but this can be used as an example to develop your own.
For yoru case i suggest a role that just does 'copy: remote_src=true+
file: state=absetusing
{{backup_file}}` returned from the task.
Hi,
this refers to #2. Thanks for the hint there. Unfortunately even with the environment variable
$ANSIBLE_LOCAL_BACKUP
set, I can't get this to work.My playbooks looks like:
I run this as
ansible-playbook local_backup.yml --user=root
oransible-playbook local_backup.yml --limit=mypc --user=root
. However after a few runs with various testfiles, I get the following situation onmypc
:this is the output with
-vvv
:HTH