diff options
Diffstat (limited to 'docs/docsite/rst/dev_guide/developing_plugins.rst')
-rw-r--r-- | docs/docsite/rst/dev_guide/developing_plugins.rst | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/docsite/rst/dev_guide/developing_plugins.rst b/docs/docsite/rst/dev_guide/developing_plugins.rst index 25662f018b..e1143cf492 100644 --- a/docs/docsite/rst/dev_guide/developing_plugins.rst +++ b/docs/docsite/rst/dev_guide/developing_plugins.rst @@ -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>`_. |