# where do i put a custom iterator?

**URL:** <https://forum.ansible.com/t/where-do-i-put-a-custom-iterator/16396>\
**Category:** Ansible Project\
**Created:** [October 1, 2014, 8:38pm UTC](https://forum.ansible.com/t/where-do-i-put-a-custom-iterator/16396 "2014-10-01T20:38:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guy\_Matz](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Guy\_Matz](https://forum.ansible.com/u/Guy_Matz)\
**Post date:** [October 1, 2014, 8:38pm UTC](https://forum.ansible.com/t/where-do-i-put-a-custom-iterator/16396/1 "2014-10-01T20:38:49Z")

</div>

ansible-playbook --version  
ansible-playbook 1.8 (devel 1d3a8bd39c) last updated 2014/09/18 10:33:54 (GMT -400)

Hi!

I’ve written a custom iterator that works when I put it in ansible/lib/ansible/runner/lookup\_plugins, however I can’t seem to get it found when I put it with my playbooks . . . does anyone know where it should go?

Thanks!

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [October 1, 2014, 9:28pm UTC](https://forum.ansible.com/t/where-do-i-put-a-custom-iterator/16396/2 "2014-10-01T21:28:56Z")

</div>

Hi Guy,

If this is a lookup plugin, you should be able to put it in a directory named “lookup\_plugins” at the same location as the playbook. I can’t find any documentation or code referencing this working in roles though, so I don’t believe you can embed lookup plugins in a role at this time (which you can do with modules).

Thanks!

---

<div class="post-metadata">

**Author:** ![Guy\_Matz](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Guy\_Matz](https://forum.ansible.com/u/Guy_Matz)\
**Post date:** [October 1, 2014, 9:47pm UTC](https://forum.ansible.com/t/where-do-i-put-a-custom-iterator/16396/3 "2014-10-01T21:47:11Z")

</div>

Awesome! yes, so moving my plugin, 12fcmds, to ansible\_root/lookup\_plugins/12fcmds.py allowed me to use the plugin as:

- name: Test of with\_cmd  
template: src=cmd.j2 dest=/tmp/{{ item.key }}.txt  
with\_12fcmds: test\_var  
tags: test

This reply is mostly for posterity . . .

Thanks!!  
Guy
