Created
March 18, 2018 20:30
-
-
Save eifelmicha/9878aab9b44ce09d68e8c8fd49fc8901 to your computer and use it in GitHub Desktop.
ansible filter for creating icinga tickets
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
# plugins/filter/icinga.py | |
from ansible.errors import AnsibleError | |
def icinga_ticket(value, salt): | |
try: | |
from pbkdf2 import PBKDF2 | |
except ImportError: | |
raise AnsibleError('pbkdf2 library is required for `icinga_ticket` filter "pip install pbkdf2"') | |
return PBKDF2(str(value), str(salt), iterations=50000).hexread(20) | |
class FilterModule(object): | |
def filters(self): | |
return dict( | |
icinga_ticket=icinga_ticket, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment