# pass variable to handler?

**URL:** <https://forum.ansible.com/t/pass-variable-to-handler/19978>\
**Category:** Ansible Project\
**Created:** [December 10, 2015, 2:06am UTC](https://forum.ansible.com/t/pass-variable-to-handler/19978 "2015-12-10T02:06:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pixel\_fairy](https://avatars.discourse-cdn.com/v4/letter/p/6f9a4e/32.png) [@pixel\_fairy](https://forum.ansible.com/u/pixel_fairy)\
**Post date:** [December 10, 2015, 2:06am UTC](https://forum.ansible.com/t/pass-variable-to-handler/19978/1 "2015-12-10T02:06:27Z")

</div>

Using the lxc module, and want to do this. is there a way?

`

- name: skip dns lookup so ssh doesnt take forever  
lineinfile:  
line: UseDNS no  
dest: /var/lib/lxc/{{ item.key }}/rootfs/etc/ssh/sshd\_config  
with\_dict: “{{ containers }}”  
notify: restart ssh

handlers:

- name: restart ssh  
command: lxc-attach --name {{ item.key }} – service ssh restart  
with\_dict: “{{ containers }}”

`

results in

`  
RUNNING HANDLER [restart ssh] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [lxctest]: FAILED! =\> {“failed”: true, “msg”: “ERROR! ‘item’ is undefined”}

`
