salt.returners.postgres

Return data to a postgresql server

To enable this returner the minion will need the psycopg2 installed and the following values configured in the minion or master config:

returner.postgres.host: 'salt'
returner.postgres.user: 'salt'
returner.postgres.passwd: 'salt'
returner.postgres.db: 'salt'
returner.postgres.port: 5432

Running the following commands as the postgres user should create the database correctly:

psql << EOF
CREATE ROLE salt WITH PASSWORD 'salt';
CREATE DATABASE salt WITH OWNER salt;
EOF

psql -h localhost -U salt << EOF
--
-- Table structure for table 'jids'
--

DROP TABLE IF EXISTS jids;
CREATE TABLE jids (
  jid   bigint PRIMARY KEY,
  load  text NOT NULL
);

--
-- Table structure for table 'returns'
--

DROP TABLE IF EXISTS returns;
CREATE TABLE returns (
  fun       text NOT NULL,
  jid       varchar(20) NOT NULL,
  return    text NOT NULL,
  id        text NOT NULL,
  success   boolean
);
CREATE INDEX ON returns (id);
CREATE INDEX ON returns (jid);
CREATE INDEX ON returns (fun);

DROP TABLE IF EXISTS highstate;
-- CREATE TABLE highstate (
--   jid       bigint PRIMARY KEY,
--   resource  text NOT NULL,
--   return    hstore
-- );
CREATE INDEX return_idx_gist
  ON highstate
  USING gist
  (return);
EOF

Required python modules: psycopg2

salt.returners.postgres.get_fun(fun)

Return a dict of the last function called for all minions

salt.returners.postgres.get_jid(jid)

Return the information returned when the specified job id was executed

salt.returners.postgres.get_jids()

Return a list of all job ids

salt.returners.postgres.get_load(jid)

Return the load data that marks a specified jid

salt.returners.postgres.get_minions()

Return a list of minions

salt.returners.postgres.returner(ret)

Return data to a postgres server

salt.returners.postgres.save_load(jid, load)

Save the load to the specified jid id

Parent topic

Previous topic

salt.returners.mysql

Next topic

salt.returners.redis_return