As it turns out, I played around a bit with this just a couple of weeks
ago, and it's quite simple.
The easiest way is to simply create a directory where your top-level
playbook is (site.yml?) called filter_plugins. Within that directory
you simply put .py files with content similar to (----%---- is just to
show where file begins/ends, don't copy that :):
----%----
def uppercase_all(arg):
return arg.upper()
class FilterModule(object):
def filters(self):
return {'uppercase_all': uppercase_all}
----%----
With the above in place, you can simply use the filter uppercase_all
within your playbooks, roles etc. Note that you don't necessarily need
to have the same name for function and filter, but it's probably better
to do it that way.
If you look at the page you posted, it will direct you to
http://docs.ansible.com/developing_plugins.html which describes most of
I wrote (although, in a bit of a less verbose way, and without
examples).
I hope this helps.
Best regards
--
Branko Majic
Jabber:
bra...@majic.rs
Please use only Free formats when sending attachments to me.
Бранко Мајић
Џабер:
bra...@majic.rs
Молим вас да додатке шаљете искључиво у слободним форматима.