I found that:
http://stackoverflow.com/questions/18195142/safely-limiting-ansible-playbooks-to-a-single-machine
2014. december 25., csütörtök 16:41:17 UTC+1 időpontban Bence Takács a
következőt írta:
>
> Thanks, Brian
>
> ...and what if i just don't want to declare it in the playbook?
> Can I make the environment a parameter for the playbook?
>
> hosts: "databases:&{{env}}"
>
>
> or when calling the playbook:
>
> ansible-playbook example.yml --limit test1
>
>
>
> Regards:
> Bence
>
> 2014. december 23., kedd 13:35:07 UTC+1 időpontban Brian Coca a következőt
> írta:
>>
>> 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/682f0a2e-f7c0-4aed-8440-526fa1eaa6f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.