delegate_to not working

Hi,

i have to understand “synchronize” module with “delegate_to”
i am installing corosync on 2 nodes

here infos:

[corosync]
node_a ansible_host=192.168.122.200
node_b ansible_host=192.168.122.201

playbook.yml

  • name: Generates corosync key
    command: corosync-keygen
    args:
    creates: /etc/corosync/authkey
    when: inventory_hostname == groups[corosync][0]

  • name: Copy authkey to other nodes ##task stop here###
    synchronize: src=/etc/corosync/authkey dest=/etc/corosync/authkey
    delegate_to: “{{ groups[corosync][0] }}”
    when: inventory_hostname != groups[corosync][0]

is this the best way to use delegate_to ?

thanks