That's not an option.
Your best bet is to handle the backup yourself before invoking 
ansible.builtin.copy or ansible.builtin.template etc. and don't specify 
backup (or "backup: false").

Use ansible.builtin.stat to get the mtime.
Then use ansible.builtin.copy to copy the .conf file where you want it. 
Specify "remote_src: true" and use the registered mtime to provide an 
extension to "dest:" that looks like what "backup: true" does. Or make it 
look different if you don't like it that way.
You can wrap all that up into a task file that you can pass variables to so 
it's easy to use for multiple files.

On Monday, October 30, 2023 at 9:29:50 AM UTC-4 Sameer Modak wrote:

> how to set different backup directory than current while using backup=yes 
> in ansible modules.
>
>
> It takes backup in current directory with .conf.date which actually valid 
> for application .conf anything
>
> do we have any way where we can give specific backup directory path 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9c663ed6-9132-480b-8cd3-025b00e48695n%40googlegroups.com.

Reply via email to