Run Postgres queries on a Windows target?

10 views
Skip to first unread message

zil...@gmail.com

unread,
Jun 23, 2021, 11:35:53 AM6/23/21
to Ansible Project
I'm aware that the postgres_* modules only run on Linux. Is there a way to run Postgres queries on a Windows target? For example, I want to CREATE DATABASE myDB

Thanks,
Chris

zil...@gmail.com

unread,
Jun 24, 2021, 10:52:02 AM6/24/21
to Ansible Project
I just put my queries in a *.sql file, for example

create_db.sql
CREATE DATABASE myDB

and do

- name: Create DB
  win_command: psql -U postgres -f create_db.sql

Reply all
Reply to author
Forward
0 new messages