salt.pillar.csvpillar

Store key/value pairs in a CSV file

New in version 2016.11.0.

Example configuration:

ext_pillar:
  - csv: /path/to/file.csv

# or

ext_pillar:
  - csv:
      path: /path/to/file.csv
      namespace: 'subkey'
      fieldnames:
      - col1
      - col2
      - col2

The first column must be minion IDs and the first row must be dictionary keys. E.g.:

id

role

env

jerry

web

prod

stuart

web

stage

dave

web

qa

phil

db

prod

kevin

db

stage

mike

db

qa

Will produce the following Pillar values for a minion named "jerry":

{
    'role': 'web',
    'env': 'prod',
}
salt.pillar.csvpillar.ext_pillar(mid, pillar, path, idkey='id', namespace=None, fieldnames=None, restkey=None, restval=None, dialect='excel')

Read a CSV into Pillar

Parameters:
  • path (str) -- Absolute path to a CSV file.

  • idkey (str) -- (Optional) The column name of minion IDs.

  • namespace (str) -- (Optional) A pillar key to namespace the values under.

  • fieldnames (list) -- (Optional) if the first row of the CSV is not column names they may be specified here instead.