Solved. This was a syntax problem.

This works

# file: site.yml
- hosts: all
  include: rails-servers.yml
  
# file: rail-servers.yml
- hosts: all
  roles:
    - mysql
    - ruby
    - memcached



This does not work

# file: site.yml
- hosts: all
  include: rails-servers.yml
  roles:
    - statsd
    - app
  
# file: rail-servers.yml
- hosts: all
  roles:
    - mysql
    - ruby
    - memcached

When I do this, the roles in rails-servers.yml (mysql / ruby / memcached) 
are executed but the roles in site.yml (statsd / app) are silently ignored. 


Solved it by changing the syntax to

# file: site.yml
-  include: rails-servers.yml
- hosts: all
  roles:
    - statsd
    - app
  
# file: rail-servers.yml
- hosts: all
  roles:
    - mysql
    - ruby
    - memcached


This is not clearly explained in the documentation. Btw I think there was 
some misunderstanding of terminology in the original
email. I was using include at play level but at playbook level.



On Wednesday, 30 April 2014 18:45:11 UTC+5:30, Michael DeHaan wrote:

> There is no play level include statement -- it simply doesn't exist.
>
> You don't include roles files, you just list them in the roles section and 
> they are loaded out of the configured roles path.
>
> What version of Ansible are you running?  I would have expected this 
> invalid keyword to raise an error in recent versions.
>
>
> On Wed, Apr 30, 2014 at 8:45 AM, Manu J <manu...@gmail.com 
> <javascript:>>wrote:
>
>> I have a playbook which looks like this
>>
>> - hosts: all
>>   include: rails-servers.yml
>>   roles:
>>     - statsd
>>     - app
>>
>> The roles in rails-servers.yml are executed. but app & statsd roles are 
>> not executed by ansible (using 1.5). 
>> If I remove the include statement it gets executed. I get no errors when 
>> I run ansible. The roles are silently ignored. 
>>
>> rails-servers is a common playbook and this particular server needs some 
>> extra roles (statsd and app). What's the
>> idiomatic way of doing it in ansible?
>>
>>  -- 
>> 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-proje...@googlegroups.com <javascript:>.
>> To post to this group, send email to ansible...@googlegroups.com<javascript:>
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/eb11fba3-2101-426f-be8a-0cecb0d7389b%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/eb11fba3-2101-426f-be8a-0cecb0d7389b%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>

-- 
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/e74eceaa-b0e1-4b3e-893b-b61154cb4ec1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to