These are chat archives for phlipper/chef-postgresql

6th
Apr 2016
Mike
@mverderese
Apr 06 2016 19:29

How do I grant privileges to a user using chef-postgresql? ie:

 Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
 mort      | mort     | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres

normally i'd run this command

GRANT ALL PRIVILEGES ON DATABASE :dbname TO :user;

but I figure there's gotta be some attribute I can set to do that. right now I have

{
    "postgresql": {
        "users": [{
            "username": "mort",
            "password": "mort",
            "superuser": true,
            "replication": false,
            "createdb": false,
            "createrole": true,
            "inherit": true,
            "replication": false,
            "login": true
        }],
        "databases": [{
            "name": "mort",
            "owner": "mort",
            "template": "template0",
            "encoding": "UTF-8",
            "locale": "en_US.UTF-8",
            "postgis": true
        }],
        "listen_addresses": "*"
    }
}

thanks!