freeipa / ansible-freeipa

Ansible roles and modules for FreeIPA
GNU General Public License v3.0
480 stars 231 forks source link

batch command support #1228

Closed abbra closed 1 month ago

abbra commented 2 months ago

While ansible-freeipa allows to have multiple IPA actions in the same block, they still submitted to IPA server separately. This causes a slowdown. Instead, a batch command from IPA API can be used to send all these commands in the same request and let IPA server to process the commands locally. This will cut down the time spent on communication.

A real life anecdotal data: deploying OpenStack infrastructure with ansible-freeipa took 4 hours, using IPA API with batch command directly completes the same action under 20 minutes.

The key culprit is the unrolling here: https://github.com/freeipa/ansible-freeipa/blob/master/plugins/module_utils/ansible_freeipa_module.py#L1403-L1426 where each IPA command is sent out separately. Instead, ansible-freeipa should repackage these commands into a list of dictionaries with the commands in them and then send that list as a single 'batch' command.

abbra commented 2 months ago

Documentation for batch command: https://freeipa.readthedocs.io/en/latest/api/batch.html (not much, admittedly) Basic usage guide: https://freeipa.readthedocs.io/en/latest/api/basic_usage.html#id9

t-woerner commented 1 month ago

Fixed with https://github.com/freeipa/ansible-freeipa/pull/1229