# salt.returners.postgres

Return data to a postgresql server

maintainer: | None
maturity: | New
depends: | psycopg2
platform: | all

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 'salt_returns'
    --

    DROP TABLE IF EXISTS salt_returns;
    CREATE TABLE salt_returns (
      added     TIMESTAMP WITH TIME ZONE DEFAULT now(),
      fun       text NOT NULL,
      jid       varchar(20) NOT NULL,
      return    text NOT NULL,
      id        text NOT NULL,
      success   boolean
    );
    CREATE INDEX ON salt_returns (added);
    CREATE INDEX ON salt_returns (id);
    CREATE INDEX ON salt_returns (jid);
    CREATE INDEX ON salt_returns (fun);
    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

Current Salt release: 0.17.1

#### Previous topic

salt.returners.mysql

#### Next topic

salt.returners.redis_return

### Quick search

Enter search terms or a module, class or function name.

### Upcoming SaltStack Events

My conferences on Lanyrd