|
|
@ -29,6 +29,7 @@ import hashlib
|
|
|
|
import string
|
|
|
|
import string
|
|
|
|
import operator as py_operator
|
|
|
|
import operator as py_operator
|
|
|
|
from random import SystemRandom, shuffle
|
|
|
|
from random import SystemRandom, shuffle
|
|
|
|
|
|
|
|
import uuid
|
|
|
|
|
|
|
|
|
|
|
|
import yaml
|
|
|
|
import yaml
|
|
|
|
from jinja2.filters import environmentfilter
|
|
|
|
from jinja2.filters import environmentfilter
|
|
|
@ -38,6 +39,9 @@ from ansible import errors
|
|
|
|
from ansible.utils import md5s, checksum_s
|
|
|
|
from ansible.utils import md5s, checksum_s
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UUID_NAMESPACE_ANSIBLE = uuid.UUID('361E6D51-FAEC-444A-9079-341386DA8E2E')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def to_nice_yaml(*a, **kw):
|
|
|
|
def to_nice_yaml(*a, **kw):
|
|
|
|
'''Make verbose, human readable yaml'''
|
|
|
|
'''Make verbose, human readable yaml'''
|
|
|
|
return yaml.safe_dump(*a, indent=4, allow_unicode=True, default_flow_style=False, **kw)
|
|
|
|
return yaml.safe_dump(*a, indent=4, allow_unicode=True, default_flow_style=False, **kw)
|
|
|
@ -297,6 +301,8 @@ def get_encrypted_password(password, hashtype='sha512', salt=None):
|
|
|
|
|
|
|
|
|
|
|
|
return None
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def to_uuid(string):
|
|
|
|
|
|
|
|
return str(uuid.uuid5(UUID_NAMESPACE_ANSIBLE, str(string)))
|
|
|
|
|
|
|
|
|
|
|
|
class FilterModule(object):
|
|
|
|
class FilterModule(object):
|
|
|
|
''' Ansible core jinja2 filters '''
|
|
|
|
''' Ansible core jinja2 filters '''
|
|
|
@ -307,6 +313,9 @@ class FilterModule(object):
|
|
|
|
'b64decode': base64.b64decode,
|
|
|
|
'b64decode': base64.b64decode,
|
|
|
|
'b64encode': base64.b64encode,
|
|
|
|
'b64encode': base64.b64encode,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# uuid
|
|
|
|
|
|
|
|
'to_uuid': to_uuid,
|
|
|
|
|
|
|
|
|
|
|
|
# json
|
|
|
|
# json
|
|
|
|
'to_json': to_json,
|
|
|
|
'to_json': to_json,
|
|
|
|
'to_nice_json': to_nice_json,
|
|
|
|
'to_nice_json': to_nice_json,
|
|
|
|