Hi there,

I wonder how (if at all) it was possible to refer to files in 
subdirectories of a role's "file" folder when using modules like "copy" and 
the like.

To clarify, let's assume we have a directory layout like this:

root/
- main.yaml
- files/
  - foo.txt
  - bar/
    - baz.txt
- roles/
  - mumbo/
    - files/
      - foo.txt
      - bar/
        - baz.txt
    - tasks/
      - main.yaml

Now within root/main.yaml, I can refer to root/files/bar/baz.txt like

  - name: copy bar/baz.txt to host
    copy:
      - src: files/bar/baz.txt
      - dest: /some/path/baz.txt

When, however, I include the "mumbo" role in root/main.yaml and I try to 
refer to root/roles/mumbo/files/bar/baz.txt from within the 
root/roles/mumbo/tasks/main.yaml file in a similar fashion, i.e. like

  - name: copy bar/baz.txt to mumbo host
    copy:
      - src: files/bar/baz.txt
      - dest: /some/other/path/baz.txt

or 

  - name: copy bar/baz.txt to mumbo host
    copy:
      - src: ../files/bar/baz.txt
      - dest: /some/other/path/baz.txt

ansible complains that it is unable to locate the source file. It is 
possible, though, to refer to files residing directly in the 
root/roles/mumbo/files folder:

  - name: copy foo.txt to mumbo host
    copy:
      - src: foo.txt
      - dest: /yet/another/path/foo.txt

works like a charm.

So am I missing something or is it really not possible to organize files in 
subdirectories?

Cheers --

Torsten



-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/025cc2cd-1ca4-4d1f-9d70-09b248226217%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to