Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postgresql_user: alter user statements missing in return value #307

Closed
betanummeric opened this issue Jul 8, 2022 · 0 comments · Fixed by #308
Closed

postgresql_user: alter user statements missing in return value #307

betanummeric opened this issue Jul 8, 2022 · 0 comments · Fixed by #308

Comments

@betanummeric
Copy link
Member

bug

The return value queries should contain a "List of executed queries", but when an existing user is alerted the alter user statements are not in the return value.

create user and drop user statements appear as expected in the return value.

tested versions

community.postgresql: 2.1.5
ansible-playbook: 2.10.8
python: 3.9.2
targeted postgresql: 14

how to repoduce

- hosts: all
  gather_facts: no
  remote_user: postgres
  tasks:
    - name: create user
      community.postgresql.postgresql_user:
        db: postgres
        name: testuser
        password: testpw
        state: present
        login_unix_socket: /tmp
      register: created_user
    - name: debug created_user
      debug:
        msg: "{{ created_user }}"

    - name: alter user
      community.postgresql.postgresql_user:
        db: postgres
        name: testuser
        password: different_password
        state: present
        login_unix_socket: /tmp
      register: altered_user
    - name: debug altered_user
      debug:
        msg: "{{ altered_user }}"

    - name: drop user
      community.postgresql.postgresql_user:
        db: postgres
        name: testuser
        state: absent
        login_unix_socket: /tmp
      register: dropped_user
    - name: debug dropped_user
      debug:
        msg: "{{ dropped_user }}"

This outputs:

TASK [debug altered_user] ******************************************************************************************************************
task path: /var/go/pwtest/test.yml:26
ok: [my-test-server] => {
    "msg": {
        "changed": true,
        "failed": false,
        "queries": [],
        "user": "testuser"
    }
}

But I expected:

TASK [debug altered_user] ******************************************************************************************************************
task path: /var/go/pwtest/test.yml:26
ok: [my-test-server] => {
    "msg": {
        "changed": true,
        "failed": false,
        "queries": [
            "ALTER USER \"testuser\" WITH ENCRYPTED PASSWORD %(password)s "
        ],
        "user": "testuser"
    }
}
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Aug 12, 2022
v6.2.0
======

.. contents::
  :local:
  :depth: 2

Release Summary
---------------

Release Date: 2022-08-02

`Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`_

Added Collections
-----------------

- ibm.spectrum_virtualize (version 1.9.0)

Ansible-core
------------

Ansible 6.2.0 contains Ansible-core version 2.13.2.
This is a newer version than version 2.13.1 contained in the previous Ansible release.

The changes are reported in the combined changelog below.

Changed Collections
-------------------

If not mentioned explicitly, the changes are reported in the combined changelog below.

+-------------------------------+---------------+---------------+------------------------------------------------------------------------------------------------------------------------------+
| Collection                    | Ansible 6.1.0 | Ansible 6.2.0 | Notes                                                                                                                        |
+===============================+===============+===============+==============================================================================================================================+
| awx.awx                       | 21.2.0        | 21.4.0        | Unfortunately, this collection does not provide changelog data in a format that can be processed by the changelog generator. |
+-------------------------------+---------------+---------------+------------------------------------------------------------------------------------------------------------------------------+
| cisco.dnac                    | 6.5.0         | 6.5.2         |                                                                                                                              |
+-------------------------------+---------------+---------------+------------------------------------------------------------------------------------------------------------------------------+
| cisco.meraki                  | 2.10.0        | 2.10.1        |                                                                                                                              |
+-------------------------------+---------------+---------------+------------------------------------------------------------------------------------------------------------------------------+
| community.dns                 | 2.2.1         | 2.3.0         |                                                                                                                              |
+-------------------------------+---------------+---------------+------------------------------------------------------------------------------------------------------------------------------+
| community.general             | 5.3.0         | 5.4.0         |                                                                                                                              |
+-------------------------------+---------------+---------------+------------------------------------------------------------------------------------------------------------------------------+
| community.grafana             | 1.5.0         | 1.5.1         |                                                                                                                              |
+-------------------------------+---------------+---------------+------------------------------------------------------------------------------------------------------------------------------+
| community.hashi_vault         | 3.0.0         | 3.1.0         |                                                                                                                              |
+-------------------------------+---------------+---------------+------------------------------------------------------------------------------------------------------------------------------+
| community.hrobot              | 1.4.0         | 1.5.0         |                                                                                                                              |
+-------------------------------+---------------+---------------+------------------------------------------------------------------------------------------------------------------------------+
| community.mongodb             | 1.4.1         | 1.4.2         | There are no changes recorded in the changelog.                                                                              |
+-------------------------------+---------------+---------------+------------------------------------------------------------------------------------------------------------------------------+
| community.postgresql          | 2.1.5         | 2.2.0         |                                                                                                                              |
+-------------------------------+---------------+---------------+------------------------------------------------------------------------------------------------------------------------------+
| community.rabbitmq            | 1.2.1         | 1.2.2         |                                                                                                                              |
+-------------------------------+---------------+---------------+------------------------------------------------------------------------------------------------------------------------------+
| community.routeros            | 2.1.0         | 2.2.0         |                                                                                                                              |
+-------------------------------+---------------+---------------+------------------------------------------------------------------------------------------------------------------------------+
| community.sap_libs            | 1.1.0         | 1.2.0         |                                                                                                                              |
+-------------------------------+---------------+---------------+------------------------------------------------------------------------------------------------------------------------------+
| ibm.spectrum_virtualize       |               | 1.9.0         | The collection was added to Ansible                                                                                          |
+-------------------------------+---------------+---------------+------------------------------------------------------------------------------------------------------------------------------+
| netapp.ontap                  | 21.20.0       | 21.21.0       |                                                                                                                              |
+-------------------------------+---------------+---------------+------------------------------------------------------------------------------------------------------------------------------+
| ovirt.ovirt                   | 2.1.0         | 2.2.0         |                                                                                                                              |
+-------------------------------+---------------+---------------+------------------------------------------------------------------------------------------------------------------------------+
| t_systems_mms.icinga_director | 1.30.0        | 1.30.1        |                                                                                                                              |
+-------------------------------+---------------+---------------+------------------------------------------------------------------------------------------------------------------------------+

Major Changes
-------------

community.postgresql
~~~~~~~~~~~~~~~~~~~~

- postgresql_user - the ``groups`` argument has been deprecated and will be removed in ``community.postgresql 3.0.0``. Please use the ``postgresql_membership`` module to specify group/role memberships instead (ansible-collections/community.postgresql#277).

Minor Changes
-------------

Ansible-core
~~~~~~~~~~~~

- ansible-test - An improved error message is shown when the download of a pip bootstrap script fails. The download now uses ``urllib2`` instead of ``urllib`` on Python 2.

cisco.meraki
~~~~~~~~~~~~

- Change shebang in Sublime utils to point to env instead of direct to the path

community.dns
~~~~~~~~~~~~~

- All software licenses are now in the ``LICENSES/`` directory of the collection root. Moreover, ``SPDX-License-Identifier:`` is used to declare the applicable license for every file that is not automatically generated (ansible-collections/community.dns#109).

community.general
~~~~~~~~~~~~~~~~~

- ModuleHelper module utils - added property ``verbosity`` to base class (ansible-collections/community.general#5035).
- apk - add ``world`` parameter for supporting a custom world file (ansible-collections/community.general#4976).
- consul - adds ``ttl`` parameter for session  (ansible-collections/community.general#4996).
- dig lookup plugin - add option ``fail_on_error`` to allow stopping execution on lookup failures (ansible-collections/community.general#4973).
- keycloak_* modules - add ``http_agent`` parameter with default value ``Ansible`` (ansible-collections/community.general#5023).
- lastpass - use config manager for handling plugin options (ansible-collections/community.general#5022).
- listen_ports_facts - add new ``include_non_listening`` option which adds ``-a`` option to ``netstat`` and ``ss``. This shows both listening and non-listening (for TCP this means established connections) sockets, and returns ``state`` and ``foreign_address`` (ansible-collections/community.general#4762, ansible-collections/community.general#4953).
- maven_artifact - add a new ``unredirected_headers`` option that can be used with ansible-core 2.12 and above. The default value is to not use ``Authorization`` and ``Cookie`` headers on redirects for security reasons. With ansible-core 2.11, all headers are still passed on for redirects (ansible-collections/community.general#4812).
- pacman - added parameters ``reason`` and ``reason_for`` to set/change the install reason of packages (ansible-collections/community.general#4956).
- xfconf - add ``stdout``, ``stderr`` and ``cmd`` to the module results (ansible-collections/community.general#5037).
- xfconf - use ``do_raise()`` instead of defining custom exception class (ansible-collections/community.general#4975).
- xfconf_info - use ``do_raise()`` instead of defining custom exception class (ansible-collections/community.general#4975).

community.grafana
~~~~~~~~~~~~~~~~~

- Export dashboard with pretty printed JSON so that it becomes easier to compare changes with the previous version

community.hrobot
~~~~~~~~~~~~~~~~

- All software licenses are now in the ``LICENSES/`` directory of the collection root. Moreover, ``SPDX-License-Identifier:`` is used to declare the applicable license for every file that is not automatically generated (ansible-collections/community.hrobot#52).

community.postgresql
~~~~~~~~~~~~~~~~~~~~

- postgresql_membership - add the ``exact`` state value to be able to specify a list of only groups a user must be a member of (ansible-collections/community.postgresql#277).
- postgresql_pg_hba - add argument ``overwrite`` (bool, default: false) to remove unmanaged rules (ansible-collections/community.postgresql#297).
- postgresql_pg_hba - add argument ``rules_behavior`` (choices: conflict (default), combine) to fail when ``rules`` and normal rule-specific arguments are given or, when ``combine``, use them as defaults for the ``rules`` items (ansible-collections/community.postgresql#297).
- postgresql_pg_hba - add argument ``rules`` to specify a list of rules using the normal rule-specific argument in each item (ansible-collections/community.postgresql#297).

community.routeros
~~~~~~~~~~~~~~~~~~

- All software licenses are now in the ``LICENSES/`` directory of the collection root. Moreover, ``SPDX-License-Identifier:`` is used to declare the applicable license for every file that is not automatically generated (ansible-collections/community.routeros#101).

netapp.ontap
~~~~~~~~~~~~

- na_ontap_cluster_config role - support ``broadcast_domain`` and ``service_policy`` with REST.
- na_ontap_info - add computed serial_hex and naa_id for lun_info.
- na_ontap_info - add quota-policy-info.
- na_ontap_interface - support ``broadcast_domain`` with REST.
- na_ontap_login_messages - support cluster scope when using REST.
- na_ontap_lun - support ``qos_adaptive_policy_group`` with REST.
- na_ontap_motd - deprecated in favor of ``na_ontap_login_messages``.  Fail when use_rest is set to ``always`` as REST is not supported.
- na_ontap_ntp - new option ``key_id`` added.
- na_ontap_qtree - Added ``unix_user`` and ``unix_group`` options in REST.
- na_ontap_rest_info - add computed serial_hex and naa_id for storage/luns when serial_number is present.
- na_ontap_s3_users - ``secret_key`` and ``access_token`` are now returned when creating a user.
- na_ontap_service_processor_network - Added REST support.
- na_ontap_snapmirror - improve errror messages to be more specific and consistent.
- na_ontap_snapmirror - new option ``validate_source_path`` to disable this validation.
- na_ontap_snapmirror - validate source endpoint for ZAPI and REST, accounting for vserver local name.
- na_ontap_snapmirror - wait for the relationship to come back to idle after a resync.
- na_ontap_unix_group - added REST support.
- na_ontap_unix_user - Added REST support.
- na_ontap_unix_user - Added new option ``primary_gid`` aliased to ``group_id``.
- na_ontap_user - accept ``service_processor`` as an alias for ``service-processor`` with ZAPI, to be consistent with REST.
- na_ontap_volume - now defaults to REST with ``use_rest`` set to ``auto``, like every other module.  ZAPI can be forced with ``use_rest`` set to ``never``.
- na_ontap_vserver_create role - support ``broadcast_domain``, ``ipspace``, and ``service_policy`` with REST.

ovirt.ovirt
~~~~~~~~~~~

- During he_setup, configure ovn with he_host_name for correct operation of ovn (oVirt/ovirt-ansible-collection#563).
- Fix "ansible-lint" version 6.0.0 "yaml" violations for "disaster_recovery" role (oVirt/ovirt-ansible-collection#543).
- Fix "ansible-lint" version 6.0.0 violations for "disaster_recovery" & "remove_stale_lun" roles (oVirt/ovirt-ansible-collection#554).
- Fix ansible-lint for basic roles (oVirt/ovirt-ansible-collection#280).
- Updating the documentation - "vm_name" / "vm_id" and/or disk "id" parameter(s) are required when extending disk with non-unique name (oVirt/ovirt-ansible-collection#559).
- gluster_heal_info - Replacing gluster module to CLI to support RHV automation hub (oVirt/ovirt-ansible-collection#340).
- ovirt_disk - Add warning for disk attachments (oVirt/ovirt-ansible-collection#347).
- ovirt_disk - Fix disk attachment to VM (oVirt/ovirt-ansible-collection#361).
- ovirt_qos, ovirt_disk_profile, ovirt_disk - Add modules to allow for creation and updating of disk_profiles (oVirt/ovirt-ansible-collection#422).
- ovirt_snapshot - Add vm_id to select VM (oVirt/ovirt-ansible-collection#550).
- ovirt_vm - Add reset of VM (oVirt/ovirt-ansible-collection#538).
- ovirt_vm - Add virtio_scsi_enabled and multi_queues_enabled (oVirt/ovirt-ansible-collection#348).
- ovirt_vm - add volatile (oVirt/ovirt-ansible-collection#539).
- repositories - Add ovirt_repositories_rhsm_environment and FIPS fix (oVirt/ovirt-ansible-collection#483).
- repositories - Replace redhat_subscription and rhsm_repository with command (oVirt/ovirt-ansible-collection#346).

Deprecated Features
-------------------

community.hashi_vault
~~~~~~~~~~~~~~~~~~~~~

- vault_kv2_get lookup - the ``engine_mount_point option`` in the ``vault_kv2_get`` lookup only will change its default from ``kv`` to ``secret`` in community.hashi_vault version 4.0.0 (ansible-collections/community.hashi_vault#279).

Bugfixes
--------

Ansible-core
~~~~~~~~~~~~

- Move undefined check from concat to finalize (ansible/ansible#78156)
- ansible-doc - no longer list module and plugin aliases that are created with symlinks (ansible/ansible#78137).
- ansible-doc - when listing modules in collections, proceed recursively. This fixes module listing for community.general 5.x.y and community.network 4.x.y (ansible/ansible#78137).
- ansible-doc will not add 'website for' in ":ref:" substitutions as it made them confusing.
- file backed cache plugins now handle concurrent access by making atomic updates to the files.
- password lookup does not ignore k=v arguments anymore.
- user - Fix error "Permission denied" in user module while generating SSH keys (ansible/ansible#78017).

cisco.dnac
~~~~~~~~~~

- application_sets - delete function fixed.
- applications - delete function fixed.
- event_subscription - delete function fixed.
- file_info - Improve the module documentation.
- sda_fabric_authentication_profile - delete function fixed.
- sda_fabric_border_device - delete function fixed.
- sda_fabric_control_plane_device - delete function fixed.
- sda_fabric_edge_device - Change required payload parameter to deviceManagementIpAddress
- sda_fabric_edge_device - delete function fixed.
- sda_virtual_network - delete function fixed.
- transit_peer_network - Added status check

community.dns
~~~~~~~~~~~~~

- Update Public Suffix List.

community.general
~~~~~~~~~~~~~~~~~

- keyring_info - fix the result from the keyring library never getting returned (ansible-collections/community.general#4964).
- pacman - fixed name resolution of URL packages (ansible-collections/community.general#4959).
- passwordstore lookup plugin - fix ``returnall`` for gopass (ansible-collections/community.general#5027).
- passwordstore lookup plugin - fix password store path detection for gopass (ansible-collections/community.general#4955).
- proxmox - fix error handling when getting VM by name when ``state=absent`` (ansible-collections/community.general#4945).
- proxmox_kvm - fix error handling when getting VM by name when ``state=absent`` (ansible-collections/community.general#4945).
- slack - fix incorrect channel prefix ``#`` caused by incomplete pattern detection by adding ``G0`` and ``GF`` as channel ID patterns (ansible-collections/community.general#5019).
- xfconf - fix setting of boolean values (ansible-collections/community.general#4999, ansible-collections/community.general#5007).

community.hashi_vault
~~~~~~~~~~~~~~~~~~~~~

- Add SPDX license headers to individual files (ansible-collections/community.hashi_vault#282).
- Add missing ``BSD-2-Clause.txt`` file for BSD licensed content (ansible-collections/community.hashi_vault#275).
- Use the correct GPL license for plugin_utils (ansible-collections/community.hashi_vault#276).

community.postgresql
~~~~~~~~~~~~~~~~~~~~

- Include ``simplified_bsd.txt`` license file for various module utils.
- postgresql_info - fix pg version parsing (ansible-collections/community.postgresql#315).
- postgresql_ping - fix pg version parsing (ansible-collections/community.postgresql#315).
- postgresql_privs.py - add functionality when the PostgreSQL version is 9.0.0 or greater to incorporate ``ALL x IN SCHEMA`` syntax (ansible-collections/community.postgresql#282). Please see the official documentation for details regarding grants (https://www.postgresql.org/docs/9.0/sql-grant.html).
- postgresql_subscription - fix idempotence by casting the ``connparams`` dict variable (ansible-collections/community.postgresql#280).
- postgresql_user - add ``alter user``-statements in the return value ``queries`` (ansible-collections/community.postgresql#307).

community.rabbitmq
~~~~~~~~~~~~~~~~~~

- user module - set supports_check_mode flag to False, as the module does not actually support check mode.

community.routeros
~~~~~~~~~~~~~~~~~~

- Include ``LICENSES/BSD-2-Clause.txt`` file for the ``routeros`` module utils (ansible-collections/community.routeros#101).

community.sap_libs
~~~~~~~~~~~~~~~~~~

- syp_system_facts - fix a typo in the usage example which lead to an error if it used as supposed.

netapp.ontap
~~~~~~~~~~~~

- na_ontap_interface - FC interfaces - home_node should not be sent as location.home_node.
- na_ontap_interface - FC interfaces - home_port is not supported for ONTAP 9.7 or earlier.
- na_ontap_interface - FC interfaces - scope is not supported.
- na_ontap_interface - FC interfaces - service_policy is not supported.
- na_ontap_interface - enforce requirement for address/netmask for interfaces other than FC.
- na_ontap_interface - fix idempotency issue for cluster scoped interfaces when using REST.
- na_ontap_interface - fix potential node and uuid issues with LIF migration.
- na_ontap_interface - ignore 'none' when using REST rather than reporting unexpected protocol.
- na_ontap_lun - catch ZAPI error on get LUN.
- na_ontap_lun - ignore resize error if no change was required.
- na_ontap_lun - report error if flexvol_name is missing when using ZAPI.
- na_ontap_net_subnet - fixed ``ipspace`` option ignored in getting net subnet.
- na_ontap_qtree - fix idempotency issue on ``unix_permissions`` option.
- na_ontap_s3_buckets - Module will not fail on create if no ``policy`` is given.
- na_ontap_s3_buckets - Module will set ``enabled`` during create.
- na_ontap_s3_buckets - Module work currently when ``sid`` is a number.
- na_ontap_snapmirror - fix potential issue when destination is using REST but source is using ZAPI.
- na_ontap_snapmirror - relax check for source when using REST.
- na_ontap_svm - KeyError on CIFS when using REST with ONTAP 9.8 or lower.
- na_ontap_volume - ``volume_security_style`` was not modified if other security options were present with ZAPI.
- na_ontap_volume - fix idempotency issue on ``unix_permissions`` option.
- na_ontap_vserver_create role - add rule index as it is now required.

ovirt.ovirt
~~~~~~~~~~~

- HE - Handle migration to hosts that use systemd-coredump (oVirt/ovirt-ansible-collection#557).
- cluster_upgrade - Fix starting up pinned vms (oVirt/ovirt-ansible-collection#532).
- he - Align role with ansible-lint-6.0 (oVirt/ovirt-ansible-collection#545).
- hosted_engine - Specify fqcn for ovirt_system_option_info (oVirt/ovirt-ansible-collection#536).
- hosted_engine_setup - Fix cleanup on el9 (oVirt/ovirt-ansible-collection#533).
- image_template - Remove static (oVirt/ovirt-ansible-collection#537).
- image_template - Remove static no - unsupported in ansible 2.12 (oVirt/ovirt-ansible-collection#341).
- ovirt_host - Fix host wait (oVirt/ovirt-ansible-collection#531).
- ovirt_host - Fix restarted wait condition (oVirt/ovirt-ansible-collection#551).
- ovirt_storage_domain - Fix inaccessible exception (oVirt/ovirt-ansible-collection#534).
- ovirt_vm - check if user inputed graphical protocol (oVirt/ovirt-ansible-collection#542).
- repositories - Move fips check to satellite CA install block (oVirt/ovirt-ansible-collection#553).
- shutdown_env - Align role with ansible-lint-6.0 (oVirt/ovirt-ansible-collection#544).

t_systems_mms.icinga_director
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Add exception handling to diff and exist functions (https://github.com/T-Systems-MMS/ansible-collection-icinga-director/pull/176)

Known Issues
------------

netapp.ontap
~~~~~~~~~~~~

- na_ontap_snapshot - added documentation to use UTC format for ``expiry_time``.

New Plugins
-----------

Lookup
~~~~~~

- community.general.bitwarden - Retrieve secrets from Bitwarden

New Modules
-----------

community.general
~~~~~~~~~~~~~~~~~

Remote Management
^^^^^^^^^^^^^^^^^

Redfish
.......

- community.general.wdc_redfish_command - Manages WDC UltraStar Data102 Out-Of-Band controllers using Redfish APIs
- community.general.wdc_redfish_info - Manages WDC UltraStar Data102 Out-Of-Band controllers using Redfish APIs

community.routeros
~~~~~~~~~~~~~~~~~~

- community.routeros.api_info - Retrieve information from API
- community.routeros.api_modify - Modify data at paths with API

community.sap_libs
~~~~~~~~~~~~~~~~~~

- community.sap_libs.sap_pyrfc - This module executes rfc functions.

netapp.ontap
~~~~~~~~~~~~

- netapp.ontap.na_ontap_ntp_key - NetApp ONTAP NTP key
- netapp.ontap.na_ontap_s3_groups - NetApp ONTAP S3 groups
- netapp.ontap.na_ontap_s3_policies - NetApp ONTAP S3 Policies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant