What's the best way to deploy changes to several databases on multiple Postgresql Databases servers
1
vote
1
answer
223
views
I was wondering if there is a better way to deploy changes to several Postgres databases on multiple servers. I have been using Ansible for this task, I have a playbook that basically copies the changes to the server, applies them to the databases, and collect the logs using
psql
:
psql -v ON_ERROR_STOP=1 -f my_changes.sql > log.out 2> log.err
But I have some problems with this approach with the INDEX
creations. Sometimes it takes several minutes or hours to create the index and I need to use background jobs with ansible using [async & poll](https://docs.ansible.com/ansible/latest/user_guide/playbooks_async.html) to allow Ansible run long tasks wihtout close the ssh connection. Also, I think I am using Ansible wrong since it is a configuration tool and this kind of task always reflect a change on the server...
Hoping you guys can tell me better approaches, tools( I heard that [pgbarman](https://pgbarman.org/) can also deploy changes) or improvements on my current solution
Asked by Javier Galarza
(81 rep)
Oct 30, 2021, 11:57 AM
Last activity: Jun 14, 2025, 10:04 AM
Last activity: Jun 14, 2025, 10:04 AM