Playbook synchronization

Hello,

I have some problems with organising my application deploy setup: I have pretty different playbooks for different groups of hosts, but these playbooks have a few common roles which execution should be synchronised through servers from all groups (db update, restart with new configs etc). This is required because it’s important that different parts of application work with the same data; also it’s important for all users to see any changes at once.

I see that servers from different playbooks are updated consequently; even if they could be updated simultaneously, I can’t find any tool for synchronisation.

Example:

palybook1:

  • hosts: group1
    roles:
  • some_stuff
  • migrate_data
  • some_more_stuff
  • switch_to_new

playbook2:

  • hosts: group2
    roles:
  • some_other_stuff
  • migrate_data
  • some_more_other_stuff
  • switch_to_new

Roles migrate_data and switch_to_new should be executed simultaneously for the whole union of group1 and group2 servers.

Is there a natural, idiomatic way in which this problem could be solved?

What you should do is have one playbook with three included play files in it.

Apply configuration to play1 and play2, then against “all” hosts you can apply the “switch_to_new” roles.

Though it does sound like you might want to investigate load balancers.