Book Image

Salt Cookbook

By : Anirban Saha
Book Image

Salt Cookbook

By: Anirban Saha

Overview of this book

If you are a professional associated with system and infrastructure management, looking at automated infrastructure and deployments, then this book is for you. No prior experience of Salt is required.
Table of Contents (13 chapters)
12
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...