Super easy!
- hosts: frontendcluster1
tasks:
...
You can have multiple plays in a playbook file.
For more complex things you can also say stuff like:
- hosts: group1:&group2
Which means "must be in both"
See http://ansibleworks.com/docs/intro_patterns.html
On Wed, Nov 27, 2013 at 2:24 PM, Khuong Dinh Pham <[email protected]>wrote:
> Hi
>
> I have this setup in my hosts
>
> server1 ansible_ssh_host=server1.xxx.com
> server2 ansible_ssh_host=server2.yyy.com
> server3 ansible_ssh_host=server3.yyy.com
>
> [frontendservers]
> server1
> server2
> server3
>
> [frontendcluster1]
> server1
> server2
>
> My playbook:
> ---
> hosts: frontendservers
> tasks:
> - name: testing
> command: copy some file
> when: $host part of 'frontendcluster1' group
>
> I only want the command to be executed for server1 and server2? How can I
> achieve that?
>
> Thx for advance.
>
> --
> 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].
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
Michael DeHaan <[email protected]>
CTO, AnsibleWorks, Inc.
http://www.ansibleworks.com/
--
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].
For more options, visit https://groups.google.com/groups/opt_out.