Skip to content

postgresql_subscription module is not idempotent #280

@jegj

Description

@jegj
SUMMARY
ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION
ansible [core 2.11.6] 
  config file = /home/jgalarza/playbook/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
  ansible collection location = /home/jgalarza/playbook/collections
  executable location = /usr/local/bin/ansible
  python version = 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0]
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
community.postgresql 2.1.4
CONFIGURATION
COLLECTIONS_PATHS(/home/jgalarza/playbook/ansible.cfg) = ['/home/jgalarza/bidb-rds->
DEFAULT_FORKS(/home/jgalarza/playbook/ansible.cfg) = 20
DEFAULT_REMOTE_USER(/home/jgalarza/playbook/ansible.cfg) = ansible
DEFAULT_ROLES_PATH(/home/jgalarza/playbook/ansible.cfg) = ['/home/jgalarza/bidb-rds>
DEPRECATION_WARNINGS(/home/jgalarza/playbook/ansible.cfg) = False
HOST_KEY_CHECKING(/home/jgalarza/playbook/ansible.cfg) = False
OS / ENVIRONMENT

Ubuntu 20.04.4 LTS

STEPS TO REPRODUCE
- name: Start subscription
  community.postgresql.postgresql_subscription:
    port: "{{ db_port }}"
    login_host: "{{ db_host }}"
    login_user: "{{ db_u }}"
    login_password: "{{ db_p }}"
    db: "{{ item.1.PGDATABASE }}"
    name: "{{ item.1.PGDATABASE }}__mypub"
    state: present
    publications: mypub
    owner: postgres
    connparams:
      host: "{{ hostvars[item.1.source.host].ansible_ssh_host }}"
      port: "{{ item.1.source.PGPORT }}"
      user: repuser
      dbname: "{{ item.1.source.PGDATABASE }}"
  register: sub_creation
  with_subelements:
    - "{{ pgcluster }}"
    - databases
  tags: [debug, database]
EXPECTED RESULTS

The task should be idempotent

ACTUAL RESULTS

The task always reports a change and run the following query:

ALTER SUBSCRIPTION mydb__mypub CONNECTION 'host=x.x.x.x po
rt=5432 user=repuser dbname=mydb'

Looks like the module always reports a change in the connection details.

The issue may be related to this line


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions