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(’ ') }}