salt.pillar.sqlite3 module

Retrieve Pillar data by doing a SQLite3 query

sqlite3 is included in the stdlib since python2.5.

This module is a concrete implementation of the sql_base ext_pillar for SQLite3.

maturity:new
platform:all

Configuring the sqlite3 ext_pillar

Use the 'sqlite3' key under ext_pillar for configuration of queries.

SQLite3 database connection configuration requires the following values configured in the master config:

Note, timeout is in seconds.

sqlite3.database: /var/lib/salt/pillar.db
sqlite3.timeout: 5.0

Legacy compatibility

SQLite3 database connection configuration previouly had keys under pillar.

pillar.sqlite3.database: /var/lib/salt/pillar.db
pillar.sqlite3.timeout: 5.0

This has been depreciated in salt Boran and will be removed in salt Nitrogen.

Complete example

sqlite3:
  database: '/var/lib/salt/pillar.db'
  timeout: 5.0

ext_pillar:
  - sqlite3:
      fromdb:
        query: 'SELECT col1,col2,col3,col4,col5,col6,col7
                  FROM some_random_table
                 WHERE minion_pattern LIKE ?'
        depth: 5
        as_list: True
        with_lists: [1,3]
class salt.pillar.sqlite3.SQLite3ExtPillar

This class receives and processes the database rows from SQLite3.

salt.pillar.sqlite3.ext_pillar(minion_id, pillar, *args, **kwargs)

Execute queries against SQLite3, merge and return as a dict