Created
June 1, 2022 15:37
-
-
Save u1735067/e9a69473f05df9fd04dbf361c698b529 to your computer and use it in GitHub Desktop.
Simple filter to mark an Ansible variable as unsafe (untested)
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 | |
"""Simple filter to mark a variable as unsafe""" | |
from __future__ import (absolute_import, division, print_function) | |
__metaclass__ = type | |
from ansible.utils.unsafe_proxy import wrap_var | |
def as_unsafe(var): | |
"""Return an unsafe copy of a variable | |
:param var: Variable to return as unsafe | |
:type var: Any | |
:return: A copy of the variable marked unsafe | |
:rtype: Any | |
""" | |
return wrap_var(var) | |
# ---- Ansible filters ---- | |
class FilterModule(object): | |
"""Filters handler""" | |
def filters(self): | |
"""Return the called filter""" | |
return { | |
'as_unsafe': as_unsafe | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment