[ansible-project] Re: Where to put files and templates that don't belong to a role

2018-04-11 Thread Mike Garris
I am in the boat of treating everything as a role. 

|some_app
| |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. 

site.yml

tasks:
- 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 
https://groups.google.com/d/msgid/ansible-project/b3fe20fe-e799-472d-8490-79157f8cdf3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible 2.4 to 2.5 files - file module change

2018-04-10 Thread Mike Garris
Am I reading the docs correctly with regards to the file module being 
changed?

"Sets attributes of files" - 
https://docs.ansible.com/ansible/2.4/list_of_files_modules.html
to
"Read file contents" - 
https://docs.ansible.com/ansible/latest/modules/list_of_files_modules.html

If so, I got some long night playbook updating to start here soon!

-- 
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 
https://groups.google.com/d/msgid/ansible-project/63f16507-1a42-40a4-b221-94b70a96cda3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.