I'm wondering what is the best practice when deploying with Ansible this kind of situation (which is quite common):
How to dispatch configuration to each server?
What I've done so far:
This choice is quite annoying, because it makes me create 2 subdomains each time:
It seems OK for 1 single example, but when dealing with lots of services (think microservices) it seems to me it could be improved.
Do you think about another possible implementation?
If you want to group redundant configuration you have to put your servers in a group in your inventory file.
[frontend]
f1 ansible_host=10.0.0.1
f2 ansible_host=10.0.0.2
[backend]
b1 ansible_host=10.0.1.1
b2 ansible_host=10.0.1.2
And then you create two files
group_vars/frontend.yml
group_vars/backend.yml
in which you put the configuration for the frontend and backend servers.
Ansible does not require, that you use any domain at all.