probably I did not make myself clear enough

>   - hosts: postgres1
>     tasks:
>       - wait_for:
>           host: <specific IP address>
>           port: 5432

I guess this would check whether 'postgres1' can connect to <specific IP 
address>:5432.

What I wanted to check (without waiting for a connection to be ready actually, 
just gathering information) was the other way around ... 

... whether 'postgres1' would be ready to accept connections from <specific IP 
address>:5432



> On 06/04/2023 1:38 PM CEST Vladimir Botka <[email protected]> wrote:
> 
>  
> On Sun, 4 Jun 2023 12:06:39 +0200 (CEST)
> dulhaver via Ansible Project <[email protected]> wrote:
> 
> > ... couple of postgres-remotes ...
> > ... to check whether postgres1 has a connection via port 5432 to a specific 
> > IP address ...
> > ... what would be the right approach (aka module) for such in an Ansible 
> > TASK?
> 
> Use the module *wait_for*. See
> https://docs.ansible.com/ansible/latest/collections/ansible/builtin/wait_for_module.html
> 
> 
> If you run the play on *postgres1* the task is simple
> 
>   - hosts: postgres1
>     tasks:
>       - wait_for:
>           host: <specific IP address>
>           port: 5432
> 
> If you run the play on multiple hosts you might want to run
> once and delegate the task 
> 
>   - hosts: all
>     tasks:
>       - wait_for:
>           host: <specific IP address>
>           port: 5432
>         delegate_to: postgres1
>         run_once: true
> 
> See: pg_isready
> https://www.postgresql.org/docs/current/app-pg-isready.html
> 
> -- 
> Vladimir Botka
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/20230604133822.77edfdfe%40gmail.com.

---
gunnar wagner | fichtestr. 1, 19386 lübz | fon: 0176 7808 9090

---
gunnar wagner | fichtestr. 1, 19386 lübz | fon: 0176 7808 9090

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/332079439.561968.1685958824639%40office.mailbox.org.

Reply via email to