I am trying to create a postgres user/role with community.postgresql.postgresql_user.
The instance I am trying to address runs on port 5436 so my TASK looks like
############################################################################
- name: create db admin user
community.postgresql.postgresql_user:
name: "{{ item }}"
become: true
port: "{{ pg_service_port.stdout }}"
loop:
- "{{ pg_service_admin }}"
############################################################################
the pg_service_port.stdout value is created earlier in my playbook and equals to 5436 in the example here
however creation of the postgres user throws this error at me:
ssh: connect to host
vm-414001-0227.step.zrz.dvz.cn-mv.de port 5436
this looks as it the expected port is used to try connection to my remote host via ssh for that particular TASK, not logging in to postgresql.
the docs imply something else though
- port
Database port to connect to.
(Aliases: login_port)[Default: 5432]
type: int
so ... what is my misinterpretation here?
I can make it work with a shell command, so at least I can confirm the variables and basic logic works
############################################################################
- name: create db_admin user with shell
ansible.builtin.shell:
cmd: '/opt/db/postgres/postgresql-12.11-postgis-3.2.1-el8-ina1/bin/psql -p {{ pg_service_port.stdout }} -c "CREATE ROLE {{ pg_service_admin }};"'
become: true
############################################################################