file module has a fetch module, which is the same as copy but in reverse.
1 | tasks: |
go to my local machine to see /tmp directory
1 | anna@ansible-controller:~/Desktop/ansible-code/inventory/modules/files-modules/inventory$ ll /tmp/ansible-node1/tmp/ansible-file-test.txt |
there are two hosts directories which are relate to my two hosts.
for the flat
, it means ansible will not distinct the files from different hosts, the latest file will overwrite the old one.
for example
1 | tasks: |
notice: the default of flat is no, I am turning on it here, it will let the new file overwrite old file
1 | anna@ansible-controller:~/Desktop/ansible-code/inventory/modules/files-modules/inventory$ ll /tmp |
from above, I can see there is only one ansible-file-test.txt
file which is from cube4200, and there is no file from ansible-node1.