hosts: databases:&test1

^ will make the playbook target only hosts that exist in both groups
http://docs.ansible.com/intro_patterns.html#patterns

On Mon, Dec 22, 2014 at 10:22 PM, Bence Takács <[email protected]> wrote:
>
> I have environments that contain different nodes of different roles/types
> like: databases, webservers, load-balancers.
> Sometimes I need to call every server of the same role/type, but sometimes I
> need to address an environment.
>
> e.g.:
>>
>> [databases]
>> test1.db.my.com  ansible_ssh_host=192.168.1.200  ansible_ssh_user=...
>> test2.db.my.com   ansible_ssh_host=192.168.1.201  ansible_ssh_user=...
>>
>> [webservers]
>> test1.web.my.com   ansible_ssh_host=192.168.1.300  ansible_ssh_user=...
>> test2.web.my.com  ansible_ssh_host=192.168.1.301  ansible_ssh_user=...
>>
>> [load-balancers]
>> test1.lb.my.com  ansible_ssh_host=192.168.1.400  ansible_ssh_user=...
>> test2.lb.my.com  ansible_ssh_host=192.168.1.401  ansible_ssh_user=...
>>
>> [test1]
>> test1.db.my.com
>> test1.web.my.com
>> test1.lb.my.com
>>
>> [test2]
>> test2.db.my.com
>> test2.web.my.com
>> test2.lb.my.com
>
>
> So sometimes I need to run some update on all 'webservers', but sometimes I
> want to stop and reconfigure all servers in 'test2'.
>
> At last I need to address a specific environment and do things on different
> nodes iin sequence, e.g.
> - ping the 'database' inside
> - 'df -h' all the webservers
> - then 'free -m' all the load-balancers
>
> How could I tell that the following playbook is only for 'test1' environment
> and I need to run the 'databases' part of the playbook only for the
> databases inside that environment?
>
> What are the starting points or steps? Topics I should read?
>
> Regards:
>    Bence
>
> --
> 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/4ad05415-ae9f-45c5-b41d-89a9340532e5%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Brian Coca

-- 
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/CAJ5XC8%3D1v4uvoo2nzru-5agwZFHa44kfBX5Yn3M%2BfRa8dkDZ7Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to