ara icon indicating copy to clipboard operation
ara copied to clipboard

ara_playbook/ara_record: set BYPASS_HOST_LOOP to run once

Open dmsimard opened this issue 4 years ago • 3 comments

These action plugins interact with the API to get a playbook or add a key/value record. When run against an inventory of 100 hosts, these shouldn't be running 100 times as they only need to run once to retrieve or set the data.

dmsimard avatar May 05 '21 14:05 dmsimard

-1

ara_playbook has a stronger case for using this, but even there I could see someone wanting to retrieve a different playbook based on the current host (e.g. storing the playbook ID that generated a machine image in a file, then using the contents of that file as playbook_id).

ara_record can currently be used for storing per-host records, which this change would prevent.

Purely per-host records could be argued to be against the design intent of the action, but consider something that's merely reliant on a value that can vary across hosts, like:

- ara_record:
    key: foo_version_{{ foo_version }}
    value: true

flowerysong avatar May 05 '21 15:05 flowerysong

Hey @flowerysong, thanks for the input and you're right, I agree.

This originates from a user asking about why the modules were running N times for N hosts and perhaps the better approach is instead to add a suggestion/recommendation to set run_once on the task unless there is a use case like the ones you mentioned.

dmsimard avatar May 05 '21 15:05 dmsimard

Putting this in draft, I have no intention of merging it but keeping it opened as a reminder for now.

dmsimard avatar Mar 25 '22 00:03 dmsimard