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

Support for include_dir #795

Open
aseques opened this issue Jan 21, 2025 · 1 comment · May be fixed by #778
Open

Support for include_dir #795

aseques opened this issue Jan 21, 2025 · 1 comment · May be fixed by #778
Assignees

Comments

@aseques
Copy link

aseques commented Jan 21, 2025

SUMMARY

This collection needs to support the new directive include_dir and a couple more that are present since postgres 16 (or at least not fail when they are present), in this blog they explain the new directives here

ISSUE TYPE

With current version 3.10 there's an error when the file pg_hba.conf has any of these:

include             file
include_if_exists   file
include_dir         directory
COMPONENT NAME

community.postgresql.postgresql_pg_hba

ANSIBLE VERSION
ansible [core 2.16.3]
  config file = None
  configured module search path = ['/home/jjuvan/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/jjuvan/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.12.7 (main, Jan 17 2025, 16:55:27) [GCC 14.2.0] (/usr/bin/python3)
  jinja version = 3.1.3
  libyaml = True

COLLECTION VERSION
# /home/jjuvan/.ansible/collections/ansible_collections
Collection           Version
-------------------- -------
community.postgresql 3.10.0 

CONFIGURATION

OS / ENVIRONMENT

Ubuntu 24.10

STEPS TO REPRODUCE

Any snipped like this

    community.postgresql.postgresql_pg_hba:
      dest: /etc/postgresql/17/main/pg_hba.conf
      contype: host
      users: "test"
      source: "192.168.1.11/32"
      comment: "test"
      databases: "test"
      method: md5
      keep_comments_at_rules: true
      backup: true

But with one of the new directives in the pg_hba.conf file

EXPECTED RESULTS

New entry being created on the file

ACTUAL RESULTS

Rule not being applied and a message about missing colums (that is normal in this case)

"module_stdout": "Traceback (most recent call last):\r\n File "/home/bassols/.ansible/tmp/ansible-tmp-1737460694.0555177-231767-112376591644504/AnsiballZ_postgresql_pg_hba.py", line 107, in \r\n _ansiballz_main()\r\n File "/home/bassols/.ansible/tmp/ansible-tmp-1737460694.0555177-231767-112376591644504/AnsiballZ_postgresql_pg_hba.py", line 99, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File "/home/bassols/.ansible/tmp/ansible-tmp-1737460694.0555177-231767-112376591644504/AnsiballZ_postgresql_pg_hba.py", line 47, in invoke_module\r\n runpy.run_module(mod_name='ansible_collections.community.postgresql.plugins.modules.postgresql_pg_hba', init_globals=dict(_module_fqn='ansible_collections.community.postgresql.plugins.modules.postgresql_pg_hba', _modlib_path=modlib_path),\r\n File "/usr/lib/python3.10/runpy.py", line 224, in run_module\r\n return _run_module_code(code, init_globals, run_name, mod_spec)\r\n File "/usr/lib/python3.10/runpy.py", line 96, in _run_module_code\r\n _run_code(code, mod_globals, init_globals,\r\n File "/usr/lib/python3.10/runpy.py", line 86, in _run_code\r\n exec(code, run_globals)\r\n File "/tmp/ansible_community.postgresql.postgresql_pg_hba_payload_6g3voh9x/ansible_community.postgresql.postgresql_pg_hba_payload.zip/ansible_collections/community/postgresql/plugins/modules/postgresql_pg_hba.py", line 1358, in \r\n File "/tmp/ansible_community.postgresql.postgresql_pg_hba_payload_6g3voh9x/ansible_community.postgresql.postgresql_pg_hba_payload.zip/ansible_collections/community/postgresql/plugins/modules/postgresql_pg_hba.py", line 1259, in main\r\n File "/tmp/ansible_community.postgresql.postgresql_pg_hba_payload_6g3voh9x/ansible_community.postgresql.postgresql_pg_hba_payload.zip/ansible_collections/community/postgresql/plugins/modules/postgresql_pg_hba.py", line 495, in init\r\n File "/tmp/ansible_community.postgresql.postgresql_pg_hba_payload_6g3voh9x/ansible_community.postgresql.postgresql_pg_hba_payload.zip/ansible_collections/community/postgresql/plugins/modules/postgresql_pg_hba.py", line 526, in read\r\n File "/tmp/ansible_community.postgresql.postgresql_pg_hba_payload_6g3voh9x/ansible_community.postgresql.postgresql_pg_hba_payload.zip/ansible_collections/community/postgresql/plugins/modules/postgresql_pg_hba.py", line 572, in add_rule\r\n File "/tmp/ansible_community.postgresql.postgresql_pg_hba_payload_6g3voh9x/ansible_community.postgresql.postgresql_pg_hba_payload.zip/ansible_collections/community/postgresql/plugins/modules/postgresql_pg_hba.py", line 993, in key\r\n File "/tmp/ansible_community.postgresql.postgresql_pg_hba_payload_6g3voh9x/ansible_community.postgresql.postgresql_pg_hba_payload.zip/ansible_collections/community/postgresql/plugins/modules/postgresql_pg_hba.py", line 741, in source\r\n File "/usr/lib/python3.10/ipaddress.py", line 83, in ip_network\r\n raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6 network')\r\nValueError: 'None/None' does not appear to be an IPv4 or IPv6 network\r\n",

@toydarian
Copy link
Collaborator

Thanks for this feature-request. Work on this is already in progress, but I can't say when it will be finished.

@toydarian toydarian linked a pull request Jan 31, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants