How to start Postgres service via pg_ctl in Ansible in background?

79 views
Skip to first unread message

zil...@gmail.com

unread,
Jun 22, 2021, 7:49:52 PM6/22/21
to Ansible Project
Ansible 2.11.0 and PostgreSQL 13

I'm using the PostgreSQL binaries to start the PostgreSQL service in Ansible, like this

- name: "Start PostgreSQL version {{ pg_version }} service"
  win_shell: "pg_ctl.exe -D {{ pg_data_dir }} -l {{ pg_log_file }} start"   

and the service does start. However, the playbook is stuck at that task, and doesn't proceed with subsequent tasks, presumably because it mimics entering that command in Powershell, where the command doesn't come back.

How can I perform the pg_ctl start command in the "background" so the task proceeds? Note, per docs, the -W (don't wait for start/stop to complete) is the default option so I shouldn't have to add it. But even if I do, the task doesn't proceed.

Thanks,
Chris
Reply all
Reply to author
Forward
0 new messages