Hi,
I am trying to copy multiple files to different locations using with_items. Could someone please help me with this
vars: main.yml
wars:
file1.war
file2.war
file3.war
file4.war
dest_path:
/tmp/{wars}
tasks- main.yml
Hi,
I am trying to copy multiple files to different locations using with_items. Could someone please help me with this
vars: main.yml
wars:
file1.war
file2.war
file3.war
file4.war
dest_path:
/tmp/{wars}
tasks- main.yml
Thank you Mohan that worked for me
How to replace the existing file on remote server …should we use any specific module for that? I tried using force=yes but it didn’t work for me.
What is happening when you try to use force: yes?
Okay got it. Is there any specific module that we can use to replace a complete file in remote server?
Thank you for your help.
Thanks,
Anusha
copy module with force yes automatically replace it. Otherwise you may need to delete it before copy task.
No change Mohan
It is not replacing the file
Try with command or shell module with cp -f.
This is not the same:
* copy module copies from the controller (where you run the
ansible-playbook command) to the client
* cp -f copies a file locally from client to itself
frank
Then your remote file is most probably identical to the one you are trying to copy
Did you check that your local file (src) is for sure different from the remote one (dest)? Run `ansible-playbook` with '-vvv' to see, which local files ansible selects (this can be confusing when you are using roles) and compare with remote file.
frank
Oh! yeah. I missed that part.
I am trying with below playbook and getting errors
Could someone please help me in writing shell commands