Reputation: 2072
This is literally day one for me in evaluating ansible. I have been asked by the team to show how ansible can be used to solve a specific problem like update 300 databases on 300 different servers... remove 2 rows of data and add 3 new ones.
I found some posts on stackoverflow showing how you can import a file using mysql and ansible... but I'm wondering if the same thing can be done with postgres. i'm looking at the documentation for the ansible postgresql module and it doesn't have import state like mysql.
http://docs.ansible.com/ansible/postgresql_db_module.html
vs.
http://docs.ansible.com/ansible/mysql_db_module.html
Any suggestions?
Thanks.
Upvotes: 2
Views: 3246
Reputation: 1309
It's not supported by the postgres module but there's nothing stopping you from writing a playbook to move over a dump file and import it into the database. You could even break up your dump file and template it out.
- hosts: db_hosts
become_user: postgres
tasks:
- copy: src=file.dmp dest=/home/postgres/file.dmp
- shell: psql dbname < file.dmp
I have performed a bulk of my oracle db configuration in this manner
Upvotes: 3