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