Skip to content

Instantly share code, notes, and snippets.

@samdoran
Created October 26, 2016 21:47
Show Gist options
  • Select an option

  • Save samdoran/2264a4ff40b72638b4195ffebc69b372 to your computer and use it in GitHub Desktop.

Select an option

Save samdoran/2264a4ff40b72638b4195ffebc69b372 to your computer and use it in GitHub Desktop.
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from random import choice
from ansible.plugins.lookup import LookupBase
class LookupModule(LookupBase):
def run(self, terms, **kwargs):
count = terms.pop(0)
ret = []
for number in range(count):
ret.append(
{
'data' : choice(terms),
'count': number
}
)
return ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment