ansible-collections / community.postgresql

Manage PostgreSQL with Ansible
https://galaxy.ansible.com/ui/repo/published/community/postgresql/
Other
106 stars 87 forks source link

Idempotency Issue with community.postgresql.postgresql_subscription Module #703

Open YuriiBudnyi opened 3 months ago

YuriiBudnyi commented 3 months ago
SUMMARY

Hello Team. I need assistance with the community.postgresql.postgresql_subscription module. I use this module to create a subscription in an AWS RDS Postgres 15.5 instance. The first run of the playbook works perfectly, and the subscription is created without any issues. However, when I run the same playbook a second time, I receive the following error:

Cannot execute SQL 'CREATE SUBSCRIPTION "subscription_name" CONNECTION 'host=example.rds.amazonaws.com port=5432 user=...password=... dbname=...' PUBLICATION "pub_name" WITH (slot_name = 'slot_name')': subscription "subscription_name" already exists

ISSUE TYPE
COMPONENT NAME

community.postgresql.postgresql_subscription v3.2.0

ANSIBLE VERSION
Ansible 2.15.0
COLLECTION VERSION
community.postgresql.postgresql_subscription v3.2.0
STEPS TO REPRODUCE
- name: Create subscription
  community.postgresql.postgresql_subscription:
    db: "{{ database_name }}"
    name: "\"{{ subscription_name }}\""
    state: present
    publications: "\"{{ publication_name }}\""
    login_user: "{{ login_user }}"
    login_host: "{{ login_host }}"
    login_password: "{{ login_password }}"
    port: "{{ port }}"
    subsparams:
      slot_name: "'{{ slot_name }}'"
    connparams:
      host: "{{ replication_host }}"
      port: "{{ replication_port }}"
      user: "{{ replication_user }}"
      password: "{{ replication_passwd }}"
      dbname: "{{ replication_db }}"
EXPECTED RESULTS

playbook result should be idempotent

ACTUAL RESULTS

Issue that subscription "subscription_name" already exists

Andersson007 commented 3 months ago

@YuriiBudnyi hello, thanks for reporting the issue! I'll put the help_wanted label, i hope someone has time to look at this ASAP

YuriiBudnyi commented 3 months ago

Hello @Andersson007. Thank you very much.