Hello Ansible users!


I am looking for suggestions for my particular use case, for which I could 
not find many other solution online.


Let's say my web application runs on 2 servers: 1 web-server + 1 db server.

To deploy each one of my servers, I have a playbook like one of the 
followings.


web_server.yml ---

- hosts: web_server

roles:

- network

- apache

- firewall



db_server.yml ---

- hosts: db_server

roles:

- network

- mysql

- firewall



Each "type" of server has a different set of roles, and I have just one 
server per type.

I am trying to write a main.yml that deploys web_server and db_server in 
parallel.


If I use "include" in main.yml, the playbooks are executed in a sequence. 
The only way I found to run everything in parallel is to use roles with 
whens, like


main.yml ---

- hosts: all

strategy: free

roles:

- network

- role: mysql

when: inventory_hostname in groups.db_server

- role: apache

when: inventory_hostname in groups.web_server

- firewall


The only cons of this approach is that with 10 different server types and 
20 different roles, the playbook is not that readable.


Are there better ways to solve this use case?


Many thanks,

Marco


-- 
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/ddac979b-47cb-4dcf-b0f1-88b62a2d966b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to