# salt.runners.survey

A general map/reduce style salt runner for aggregating results returned by several different minions.

Added in version 2014.7.0.

Aggregated results are sorted by the size of the minion pools which returned matching results.

Useful for playing the game: "some of these things are not like the others..." when identifying discrepancies in a large infrastructure managed by salt.

salt.runners.survey.diff(*args, **kwargs)

  Return the DIFFERENCE of the result sets returned by each matching minion pool

  Added in version 2014.7.0.

  These pools are determined from the aggregated and sorted results of a salt command.

  This command displays the "diffs" as a series of 2-way differences -- namely the difference between the FIRST displayed minion pool (according to sort order) and EACH SUBSEQUENT minion pool result set.

  Differences are displayed according to the Python `difflib.unified_diff()` as in the case of the salt execution module `file.get_diff`.

  This command is submitted via a salt runner using the general form:

      salt-run survey.diff [survey_sort=up/down] <target>
                   <salt-execution-module> <salt-execution-module parameters>

  Optionally accept a `survey_sort=` parameter. Default: `survey_sort=down`

  CLI Example #1: (Example to display the "differences of files")

      salt-run survey.diff survey_sort=up "*" cp.get_file_str file:///etc/hosts

salt.runners.survey.hash(*args, **kwargs)

  Return the MATCHING minion pools from the aggregated and sorted results of a salt command

  Added in version 2014.7.0.

  This command is submitted via a salt runner using the general form:

      salt-run survey.hash [survey_sort=up/down] <target>
                <salt-execution-module> <salt-execution-module parameters>

  Optionally accept a `survey_sort=` parameter. Default: `survey_sort=down`

  CLI Example #1: (functionally equivalent to `salt-run manage.up`)

      salt-run survey.hash "*" test.ping

  CLI Example #2: (find an "outlier" minion config file)

      salt-run survey.hash "*" file.get_hash /etc/salt/minion survey_sort=up