i am trying to setup pgbackrest with ansible and i have stumbled upon GRANTing EXECUTE on the function pg_backup_start
i have the following ansible snippet:
- name: GRANT EXECUTE on function pg_start_backup
community.postgresql.postgresql_privs:
database: postgres
privs: EXECUTE
schema: pg_catalog
objs: "pg_start_backup(label text: fast boolean)"
type: function
roles: ${dockeruser}
login_user: ${db_admin_user}
login_password: ${db_admin_password}
login_host: localhost
which gives the following error. which indicates that the function doesnt exist
ā "invocation": {
ā "module_args": {
ā "ca_cert": null,
ā "connect_params": {},
ā "database": "postgres",
ā "fail_on_role": true,
ā "grant_option": null,
ā "login_host": "localhost",
ā "login_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
ā "login_unix_socket": "",
ā "login_user": "postgres",
ā "objs": "pg_start_backup(label text: fast boolean)",
ā "password": "",
ā "port": 5432,
ā "privs": "EXECUTE",
ā "roles": "docker-service",
ā "schema": "pg_catalog",
ā "session_role": null,
ā "ssl_cert": null,
ā "ssl_key": null,
ā "ssl_mode": "prefer",
ā "state": "present",
ā "target_roles": null,
ā "trust_input": true,
ā "type": "function"
ā }
ā },
ā "msg": "Cannot execute SQL 'GRANT EXECUTE ON function \"pg_catalog\".\"pg_start_backup\"(label text, fast boolean) TO \"docker-service\";': function pg_catalog.pg_start_backup(text, boolean) does not exist\n"
ā }
but when i try with the following ansible:
- name: GRANT EXECUTE on function pg_start_backup
community.postgresql.postgresql_privs:
database: postgres
privs: EXECUTE
schema: pg_catalog
objs: "pg_start_backup"
type: function
roles: ${dockeruser}
login_user: ${db_admin_user}
login_password: ${db_admin_password}
login_host: localhost
i get the following error:
ā "changed": false,
ā "invocation": {
ā "module_args": {
ā "ca_cert": null,
ā "connect_params": {},
ā "database": "postgres",
ā "fail_on_role": true,
ā "grant_option": null,
ā "login_host": "localhost",
ā "login_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
ā "login_unix_socket": "",
ā "login_user": "postgres",
ā "objs": "pg_start_backup",
ā "password": "",
ā "port": 5432,
ā "privs": "EXECUTE",
ā "roles": "docker-service",
ā "schema": "pg_catalog",
ā "session_role": null,
ā "ssl_cert": null,
ā "ssl_key": null,
ā "ssl_mode": "prefer",
ā "state": "present",
ā "target_roles": null,
ā "trust_input": true,
ā "type": "function"
ā }
ā },
ā "msg": "Illegal function / procedure signature: \"pg_start_backup\"."
ā }
i have search through internet and chatgpt for an example but my skills fails me
i tried to grant for a function that has no paramters pg_backend_pid
- name: GRANT EXECUTE on function pg_start_backup
community.postgresql.postgresql_privs:
database: postgres
privs: EXECUTE
schema: pg_catalog
objs: "pg_backend_pid()"
type: function
roles: ${dockeruser}
login_user: ${db_admin_user}
login_password: ${db_admin_password}
login_host: localhost
which succeeds