Search code examples
salt-project

Evaluate salt-stack's ext_pillar once for all minions


ext_pillar feature allows salt master to append dynamic data to each minion's pillar dictionary. This is achieved by salt master evaluating an eponymous python function on behalf of each minion during the pillar refresh stage.

When a large number of minions is present in the stack, the ext_pillar function would be evaluated multiple times, on behalf of each minion. In many cases this is highly undesirable, due to performance or other resource limits.

Thus, the question arises: is there a way to evaluate the ext_pillar function once per pillar_refresh command and then reuse the produced dictionary for all selected minions?


Solution

  • There isn't a way to do that right now. There has been an optimization done to many of the external pillar modules to cache the connection to the database, so that at least the connection is not created and torn down for each minion. But that doesn't have the optimization you're talking about regarding making one large query for all the minions at once.

    Would you mind opening an issue here: https://github.com/saltstack/salt/issues/new

    That will help make sure this gets discussed and considered. I see a lot of value in it.