Insert minion return data into a sqlite3 database
Mickey Malone <mickey.malone@gmail.com>
New
None
All
Sqlite3 is a serverless database that lives in a single file. In order to use this returner the database file must exist, have the appropriate schema defined, and be accessible to the user whom the minion process is running as. This returner requires the following values configured in the master or minion config:
sqlite3.database: /usr/lib/salt/salt.db
sqlite3.timeout: 5.0
Alternative configuration values can be used by prefacing the configuration. Any values not found in the alternative configuration will be pulled from the default location:
alternative.sqlite3.database: /usr/lib/salt/salt.db
alternative.sqlite3.timeout: 5.0
Use the commands to create the sqlite3 database and tables:
sqlite3 /usr/lib/salt/salt.db << EOF
--
-- Table structure for table 'jids'
--
CREATE TABLE jids (
jid TEXT PRIMARY KEY,
load TEXT NOT NULL
);
--
-- Table structure for table 'salt_returns'
--
CREATE TABLE salt_returns (
fun TEXT KEY,
jid TEXT KEY,
id TEXT KEY,
fun_args TEXT,
date TEXT NOT NULL,
full_ret TEXT NOT NULL,
success TEXT NOT NULL
);
EOF
To use the sqlite returner, append '--return sqlite3' to the salt command.
salt '*' test.ping --return sqlite3
To use the alternative configuration, append '--return_config alternative' to the salt command.
New in version 2015.5.0.
salt '*' test.ping --return sqlite3 --return_config alternative
To override individual configuration items, append --return_kwargs '{"key:": "value"}' to the salt command.
New in version 2016.3.0.
salt '*' test.ping --return sqlite3 --return_kwargs '{"db": "/var/lib/salt/another-salt.db"}'
Return a dict of the last function called for all minions
Return the information returned from a specified jid
Return a list of all job ids
Return the load from a specified jid
Return a list of minions
Do any work necessary to prepare a JID, including sending a custom id
Insert minion return data into the sqlite3 database
Save the load to the specified jid
Included for API consistency