I use ansible to prepare some (unfortunately untidy) updates which consist of replacing old files by new files. Therefore I would need to
- backup old files
- copy new files
So I create for each update a playbook folder with
backup.yml → saves the old files (loops over vars.yml)
copy.yml → copies the new files (loops over vars.yml)
vars.yml → defines where new files shall be copied to
(see tree below)
update2014-05-12/
– backup.yml
– copy.yml
– newfiles– file1.jar
– file2.jar
– file3.jar
`–file4jar
– oldfiles– vars.yml
The problem is now:
If in my copy.yml I copy from newfiles directory, the newfiles directory is not found (I posted my copy task below)
- name: copy files
synchronize:
archive=no
src=newfiles/{{item.1}}
dest={{ item.0.dest_dir }}{{ item.1 }}
with_subelements: - copy_files
- files
Is there a way to specify in a playbook where to look up files (like the ‘files’ directory in roles)?