Last active
September 1, 2016 15:55
-
-
Save lanky/e9ff4ba2aa185b25b4d3f4907b8e28c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from ansible import errors | |
import types | |
def split(input, sep=' ', maxsplit=0): | |
if not isinstance(input, types.StringTypes) or not isinstance(sep, types.StringTypes): | |
raise errors.AnsibleFilterError('split only operates on strings') | |
if maxsplit > 0: | |
return input.split(sep, maxsplit) | |
return input.split(sep) | |
class FilterModule(object): | |
def filters(self): | |
return { | |
'split' : split, | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment