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.
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
Create and edit
/opt/salt-cookbook/pillar/staging/postgresql/init...