I am in the boat of treating everything as a role. 

| |____site.yml
| |____roles
| | |____some_app_name
| | | |____vars
| | | |____tasks
| | | |____defaults
| | | |____files
| | | |____templates

Now you could, if needed, create a site.yml that would have variables to 
execute, or not execute, certain roles inside of the "roles" directory. 


- include_role:
    name: some_app_1
  when: some_app1_variable == "true"

- include_role:
    name: some_app_2
  when: some_app2_variable == "true"

This doesn't really get around your problem of having a generic location 
for files/templates. Just an opinion on the "everything as a role" comment. 

Happy Coding!!

On Wednesday, April 11, 2018 at 9:13:52 AM UTC-4, Clayton Louden wrote:
> Hi everyone,
> Where do you usually put files or templates that are just used in a 
> certain play but are not part of a role? Currently I do have them just 
> alongside my playbooks organised by play
> someplay.yml
> files/
>   someplay/somefile
>   someotherplay/someotherfile
> templates
>   someplay/sometemplate.j2
>   someotherplay/someothertemplate.j2
> This however is a bit awkward when using it in a play since I always have 
> to specify the play subfolder in files/ or templates/
>     - name: Copy extensions.conf 
>       copy: src=files/someplay/extensions.conf dest=/etc/extensions.conf 
> Now this can be easily solved by converting that particular playbook into 
> a role and then just using 'templates/somethemplate.js' and 
> 'files/somefile' without the 'play' subdirectory. That however has the 
> side-effect that I'd have a rather stupid playbook that just includes a 
> role, which I find rather annoying:
> - name: Configure server 
>   hosts: mysinglehost
>   roles: 
>     - role: custom_configure_server_role
> I've heard from other ansible guys that they treat 'everything as a role'. 
> Maybe it's just me but I find that opening a playbook just to find out that 
> it contains just one custom role a bit redundant. How do you guys usually 
> do this?
> Cheers!

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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to