ansible / proposals

Repository for sharing and tracking progress on enhancement proposals for Ansible.
Creative Commons Zero v1.0 Universal
92 stars 19 forks source link

Possibility for serialization within parallel processed groups #168

Open tuckson opened 4 years ago

tuckson commented 4 years ago

Proposal: Add possibility for serialization within parallel processed groups

Author: Your Name <@tuckson> IRC: handle (if different)

Date: 2019-07-12

Motivation

In ansible we can control how many servers are processed at the same time via the 'serial' parameter. However in a large, loadbalanced environment there is another architectural thing we need to worry about. These are the vips inside the loadbalancers. In short: many of may servers are grouped in pools in a loadbalancer. And while I do not want to process more then 2 memmbers of such a pool at the same time to avoind performance degradation for my customers, it makes perfectly sense to process servers in other pools at the same time (but also not more than 2 servers of such a pool). At this moment I see no way of achieving that inside ansible. Hence this feature request.

Problems

What problems exist that this proposal will solve?

Solution proposal

Suppose the top part of the playbook:

- name: Wedosomething
   hosts: allservers
   vars:
       srvdowntime: 120
   gather_facts: yes
   become: true
   serial: 2
   groups-parallel: yes

In the inventory:

[allservers:children]
Group1
Group2
Group3

[Group1]
Server[1:5]

[Group2]
Server[6:10]

[Group3]
Server[11:15]

If groups-parallel is set to 'yes' then 'serial: 2' scopes to childgroup level. In that case ansible starts and processes these servers at the same time: Server1, Server2,Server6,Server7.Server11,Server12 (And it goes on per group until al servers are finished).

If groups-parallel is set to 'no' or is it (default) absent, than 'Serial: 2' scopes for to all hosts and ansible starts with processing Server1, Server2 at the same time (and proceeds after that).

Without Serial groups-parallel is of no use. When you put a groupname without [:children] after 'hosts: ' neither. And the same goes for 'hosts: all'.

Dependencies (optional)

Explain any dependencies. This section is optional but could be helpful.

Testing (optional)

Does / should this require testing, and if so, how? Describe here. This section is optional but could be helpful. Absolutely. Since this will require you to change the parts that process the inventory I suppose some serious testing would be nice.

Documentation (optional)

Does / should this require documentation? If so, describe here. This section is optional but could be helpful. Yes, The documentation should describe the use and limits of the new parameter.

Anything else?

Feel free to ask for clarification

bcoca commented 4 years ago

There are several things assumed/required above that are not part of how groups work:

So to implement this proposal we would have to radically change how groups are handled internally.