Managing postgres functions/tirggers with ansible

17 views
Skip to first unread message

Dick Visser

unread,
Apr 17, 2024, 11:00:30 AM4/17/24
to ansible...@googlegroups.com
Hi,,

I'm trying to manage a postgres database with ansible.
Database OK, users OK, tables OK.
But now I have a table which has a field that should auto update with
NOW() upon changes. So far that requires SQL statements like this:

CREATE FUNCTION ...
CREATE TRIGGER...

I looked at https://docs.ansible.com/ansible/latest/collections/community/postgresql/index.html
but I don;t immediately see something that suits...
Any suggestions?

thx!

Dick

Roland Müller

unread,
Apr 17, 2024, 3:21:44 PM4/17/24
to Ansible Project
Hello,

I think the postgresql ansible module is for administrating postgresql or enabling the execution of scripts or queries rather then providing a some layer around DDL or DML  commands for PostgreSQL.

You should be able to use postgresql_query_module or postgresql_script_module for executing the SQL you have to provide.

BR,
Roland
Reply all
Reply to author
Forward
0 new messages