I really like the idea of role-base configuration of hosts. What do I
mean with this? A role means to me e.g. "database-server", "app-
server", "web-server". Depending on the environment (test or
production) I would like to assign these roles to hosts in a different
way:
Production environment with 4 separate hosts:
prod-db-host role(s): database-server
prod-app1 role(s): app-server,
prod-app2 role(s): app-server,
prod-web-server role(s): web-server
Frank's test environment with just 1 host that is doing everything:
test-frank-host role(s): database-server+app-server+web-server
Now I write how I try to implement this with Ansible. I would like to
get some feedback whether there are better ways to do this.
I configure playbooks for each role, i.e. I create a "database-
server.yml", "app-server.yml", "web-server.yml". These playbooks also
include some things like e.g. handlers. Each of this playbook is
restricted to only one role, i.e. the "database-server.yml" starts
with
I really like the idea of role-base configuration of hosts.
Groups are usable for this.
Have a play for each group.
I also would like to put all together playbooks together to simply the
execution, i.e. I would like to create a “all.yml” that includes
database-server.yml", “app-server.yml”, “web-server.yml” (to simplify
the execution and to have all stuff in my version control system):
ansible-playbook all.yml --debug --inventory=prod-hosts
Just have a top level play with multiple plays for each group
The first play targets web servers and runs webserver.yml, the next targets database servers and runs dbserver.yml, etc
Unfortunately, this is impossible because nested includes are not
allowed.