ansible-collections/community.postgresql

Create postgresql_domain module

Open

#706 opened on Jun 14, 2024

View on GitHub
 (17 comments) (0 reactions) (0 assignees)Python (116 forks)auto 404
enhancementhelp wanted

Repository metrics

Stars
 (142 stars)
PR merge metrics
 (PR metrics pending)

Description

SUMMARY

This would be a new module to manage domains. Interface would be exactly analogous to postgresql.ext, postgresql.schema, or many others that manage create, drop and alter other major postgres objects

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

postgresql_domain

ADDITIONAL INFORMATION

There is currently no easy or obvious way to manage domains idempotently in ansible playbooks, the way there now is for tables, schemas, extensions, etc.

Domains are a puzzling exception to the wonderful way almost all other postgres objects can be managed in ansible. Without this, a developer will have to fall back on raw queries through the query module, and manage idempotence manually

    - name: Create a COUNT domain in the INVENTORY schema
      become_user: postgres
      community.postgresql.postgresql_domain:
        name: "COUNT"
        db: "WIDGET_INC"
        schema: "INVENTORY"
        base_type: "INT"
        check: "VALUE >= 0"
        default: 0
        cascade: false
        comment: "Domains are a great, underused tool for code readability and maintainability"
        state: present

Contributor guide