The basic directory structure of an Ansible role is:
rolename
files
templates
tasks
...
Now my question is can the files or templates folders have a directory structure inside them like this:
rolename
files
templates
etc
hosts
tasks
...
So my task could look like:
- name: Approve hosts file
template:
src: ./etc/hosts (I WANT TO REFERENCE THE FILE INSIDE THE TEMPLATES FOLDER)
dest: /etc/hosts
This does not work :(
How do I reference the file inside the templates folder?
IMPORTANT I do not want a flat structure inside the templates folder because I want to mimic the file system so I know where the file will be copied to just by looking at the templates folder structure.
FYI When I use a flat structure it works.