# delegate\_to not working

**URL:** <https://forum.ansible.com/t/delegate-to-not-working/27647>\
**Category:** Ansible Project\
**Created:** [May 27, 2018, 11:16pm UTC](https://forum.ansible.com/t/delegate-to-not-working/27647 "2018-05-27T23:16:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manous](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@Manous](https://forum.ansible.com/u/Manous)\
**Post date:** [May 27, 2018, 11:16pm UTC](https://forum.ansible.com/t/delegate-to-not-working/27647/1 "2018-05-27T23:16:17Z")

</div>

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
