Add below parameters and try if that works for you.

delegate_to: nodename/nodeip
run_once: true

Cheers,
Soumya

On Sun, Feb 16, 2020, 1:27 AM sandkan <[email protected]> wrote:

> Playbook is running task on wrong node: I have two nodes and this task has
> to run on a specific one and not the other, as well as only running once.
> I have tried adding a sort() like this: {{ansible_play_batch | join(' ') |
> sort()}}.
> I'm not even sure why I need to add spaces after ansible_play_batch.
> This is the command I am trying to translate to ansible. It is wrongly
> running the command pn server "pcmk-2" instead of "pcmk-1".
> Command: pcs cluster setup --name mycluster pcmk-1 pcmk-2
>
> My Ansible:
> - name: Setup message bus
> run_once: true
> command: >
> pcs cluster setup --name {{ cluster_name | quote }}
> {{ ansible_play_batch | join(' ') }}
>
> --
> 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/88d03557-f5b4-4b9b-bd5a-946a2b971bd4%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/88d03557-f5b4-4b9b-bd5a-946a2b971bd4%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAH6PPPv-RAHjiKNggjLPc1aQT%2BizttwBywtvYY1D2CVSUgUyCQ%40mail.gmail.com.

Reply via email to