salt.pillar.nsot

A module that adds data to the Pillar structure from the NSoT API.

New in version Neon.

Configuring the NSoT ext_pillar

The following fields are required:

ext_pillar:
  - nsot:
    api_url: http://nsot_url.com/api/
    email: 'user@site.com'
    secret_key: abc123

Note

Note the trailing slash on the api_url field. Although NSoT gives the option of whether or not to use the tailing slash, this module assumes that the APPEND_SLASH option is set to True (the default)

The following fields are optional:

fqdn_separator: str

This is in case a minion_id contains a dot. Because NSoT doesn't allow hostnmes with dots, this option allows you to look up a device with this character replacing dots. For example, with this option set to '-', the minion rtr1.lax1 would be looked up in NSoT as rtr1-lax1.

all_devices_regex: list

This is a list of minions that will receive all device information in NSoT, given in the form of regular expressions. These minions do not need to be in nsot in order to retrieve all device info from nsot.

minion_regex: list

This is in case you only want certain minions being looked up in NSoT. For example, if you have 500 minions on a single master, you may not want all of them hitting the NSoT endpoint. With this list of regular expressions, only minions that match will be queried. This is assumed to be a network device that exists in nsot.

Here's an example config with all options:

ext_pillar:
  - nsot:
    api_url: http://nsot_url.com/api/
    email: 'user@site.com'
    secret_key: abc234
    fqdn_separator: '-'
    all_devices_regex:
      - 'server*'
      - '^cent*'
    minion_regex:
      - 'rtr*'
      - 'sw*'
      - '^router*'
salt.pillar.nsot.ext_pillar(minion_id, pillar, api_url, email, secret_key, fqdn_separator=None, all_devices_regex=None, minion_regex=None)

Query NSoT API for network devices