I would like to write an Ansible playbook which tries to handle some postgresql command. I did earlier a similar playbook, but in that case Postgresql didn't need password.
I thought I could use my old playbook, which works fine, but I was wrong. This database requires password. I know that Ansible has postgresql support which is fine (postgresql_db, postgresql_ext, postgresql_lang, postgresql_privs, postgresql_user) and with them I can do half of the work and it handles password just fine, BUT I can't figure out how to send a simple sql commands to my database. In my old playbook I used "shell" command to send those requests (eg: shell: "psql {{ databases.name }} --username {{ admin_user}} -c 'DROP SCHEMA public CASCADE;'").
And also I would like to upload a db_dump. Earlier I used psql for this, but this new database requires password...
Can someone give me tips how to handle this situation? I'm using ansible 2.0 and the database can be reached only from a specific remote host.
Thanks