Hi !
I'm currently thinking what is the best way to build a complete infrastructure based on Ansible 2.
For example, take an installation of WordPress which need Apache and MySQL :
1/ I have 3 standalones roles which uses for each task delegate_to with a variable :
- role apache
- role mysql
- role wordpress (dependencies : apache & mysql)
2/ I have 1 playbook which call multiples times the wordpress role with differents variables (servers, instance name, ...) for the differents WordPress instances. The host used to run the playbook is localhost.
The overall solution looks good, roles are decoupled, reusables and the maintenance will not be a nightmare.
But in the documentation (intro to playbooks), I've read that "the goal of a play is to map a group of hosts to some well defined roles" and what I do is to map forever to localhost.
Is my solution is acceptable in the Ansible's philosophy ? My goal is not to thinking, virtual machine but services.
Best regards,
Sylvain