How about you add server1 and server2 to a group in your inventory - 
something like this

[application_servers]
server1
server2


 and then change  sites/playbook.yml so it does 

hosts: application_servers


instead of 

hosts: all


If you want to run the same playbook on different server types, you can 
specify multiple host groups in your 'hosts' line

hosts: application_servers:webservers:database_servers

Hope this helps

Jon




On Thursday, May 25, 2017 at 6:34:41 AM UTC+1, Pierre Mavro wrote:
>
> Hi,
>
> I have to run something like this in a playbook task:
>
> ansible-playbook sites/playbook.yml --limit=server1,server2
>
> I would like to include this playbook in another playbook. How to add the 
> --limit parameter:
>
> - name: my run list
>   hosts: localhost
>   connection: local
>   gather_facts: False
>   tasks:
>     - include: sites/playbook.yml
>     - name: my other tasks
>     ...
>
> The --limit parameter content is generated on the fly, so I don't know in 
> advance the servers where the playbook will be applied.
>
> Any ideas ?
>
> Thanks
>

-- 
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/fedde168-9606-4743-9698-63936425299e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to