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

Configuring PostgreSQL databases


Once the groups and users are set up in the PostgreSQL database, it is then time to configure some databases and extensions. In this recipe, we will learn how to configure databases and extensions, and relate them with the groups and users we have already configured.

How to do it...

We will use the same minion as the previous recipe.

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

    include:
      - postgresql.users
    
    postgres_staging_db:
      postgres_database.present:
        - name: stagingdb
        - owner: stgdb
        - require:
          - postgres_user: postgres_db_user
  2. Edit /opt/salt-cookbook/staging/top.sls to have the following entries:

    staging:
      '*':
        - postgresql.database
  3. Apply the state to the minion, using the following command:

    [root@salt-master ~]# salt 'salt-minion-postgresql' state.highstate saltenv=staging
    salt-minion-postgresql:
    ----------
    .
    .
    .
    .
    ----------
              ID: postgres_staging_db
        Function: postgres_database...