Vars Plugin Documentation Improvement (#80470)

pull/80589/head
Tim Way 1 year ago committed by GitHub
parent ed9cd39d0f
commit 791510ccba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -544,6 +544,19 @@ Include the ``vars_plugin_staging`` documentation fragment to allow users to det
- vars_plugin_staging
'''
At times a value provided by a vars plugin will contain unsafe values. The utility function `wrap_var` provided by `ansible.utils.unsafe_proxy` should be used to ensure that Ansible handles the variable and value correctly. The use cases for unsafe data is covered in :ref:`unsafe_strings`.
.. code-block:: python
from ansible.plugins.vars import BaseVarsPlugin
from ansible.utils.unsafe_proxy import wrap_var
class VarsPlugin(BaseVarsPlugin):
def get_vars(self, loader, path, entities):
return dict(
something_unsafe=wrap_var("{{ SOMETHING_UNSAFE }}")
)
For example vars plugins, see the source code for the `vars plugins included with Ansible Core
<https://github.com/ansible/ansible/tree/devel/lib/ansible/plugins/vars>`_.

Loading…
Cancel
Save