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 ...

Get Salt Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.