Skip to content

Instantly share code, notes, and snippets.

@eifelmicha
Created March 18, 2018 20:30
Show Gist options
  • Save eifelmicha/9878aab9b44ce09d68e8c8fd49fc8901 to your computer and use it in GitHub Desktop.
Save eifelmicha/9878aab9b44ce09d68e8c8fd49fc8901 to your computer and use it in GitHub Desktop.
ansible filter for creating icinga tickets
# 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