Book Image

Salt Cookbook

By : Anirban Saha
Book Image

Salt Cookbook

By: Anirban Saha

Overview of this book

Table of Contents (18 chapters)
Salt Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Setting up PostgreSQL groups and users


After setting up our PostgreSQL environment, the next important task is to set up the authentication process for users and groups. In this recipe, you will learn how to create groups and users in PostgreSQL database.

How to do it...

We will use the same minion as the previous recipe.

  1. Create and edit /opt/salt-cookbook/staging/postgresql/users.sls to have the following entries:

    postgres_db_grp:
      postgres_group.present:
        - name: stggrp
        - login: True
    
    postgres_db_user:
      postgres_user.present:
        - name: stgdb
        - password: {{ pillar['postgresql']['passwd'] }}
        - encrypted: True
        - groups: stggrp
        - require:
          - postgres_group: postgres_db_grp
    
    postgres_admin_user:
      postgres_user.present:
        - name: stgadmin
        - password: {{ pillar['postgresql']['passwd'] }}
        - encrypted: True
        - createdb: True
        - createroles: True
        - createuser: True
        - login: True
  2. Create and edit /opt/salt-cookbook/pillar/staging/postgresql/init...