where do i put a custom iterator?

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!

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!

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