Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i move all files in a directory to another using Ansible module?

Tags:

ansible

if you're going to move ALL files in a certain folder to another using Ansible, you would use the command module something like:

command: mv /home/user/boxA/* /var/www/boxB/

But it occurred an stderr saying you cannot move the "/home/user/boxA/*".

I think it should be an easier findable solution .

Thanks.

like image 487
daicky777 Avatar asked May 09 '17 17:05

daicky777


People also ask

How do I move multiple files in Ansible?

find: paths: /path/to/files/ # ... the rest of the task register: list1 - name: Find more files you want to move ansible. builtin. find: paths: /different/path/ # ... the rest of the task register: list2 - name: Copy the files ansible.


1 Answers

You should use shell module instead of command to use globbing.

shell: mv /home/user/boxA/* /var/www/boxB/
like image 69
Andrew Avatar answered Sep 30 '22 19:09

Andrew