playbooks_filters.rst (ansible-2.14.0) | : | playbooks_filters.rst (ansible-2.14.1rc1) | ||
---|---|---|---|---|
skipping to change at line 2038 | skipping to change at line 2038 | |||
As of version 2.6, you can define the type of encoding to use, the default is `` utf-8``: | As of version 2.6, you can define the type of encoding to use, the default is `` utf-8``: | |||
.. code-block:: yaml+jinja | .. code-block:: yaml+jinja | |||
{{ encoded | b64decode(encoding='utf-16-le') }} | {{ encoded | b64decode(encoding='utf-16-le') }} | |||
{{ decoded | string | b64encode(encoding='utf-16-le') }} | {{ decoded | string | b64encode(encoding='utf-16-le') }} | |||
.. note:: The ``string`` filter is only required for Python 2 and ensures that t ext to encode is a unicode string. Without that filter before b64encode the wron g value will be encoded. | .. note:: The ``string`` filter is only required for Python 2 and ensures that t ext to encode is a unicode string. Without that filter before b64encode the wron g value will be encoded. | |||
.. note:: The return value of b64decode is a string. If you decrypt a binary bl | ||||
ob using b64decode and then try to use it (for example by using :ref:`copy <copy | ||||
_module>` to write it to a file) you will mostly likely find that your binary ha | ||||
s been corrupted. If you need to take a base64 encoded binary and write it to d | ||||
isk, it is best to use the system ``base64`` command with the :ref:`shell module | ||||
<shell_module>`, piping in the encoded data using the ``stdin`` parameter. For | ||||
example: ``shell: cmd="base64 --decode > myfile.bin" stdin="{{ encoded }}"`` | ||||
.. versionadded:: 2.6 | .. versionadded:: 2.6 | |||
Managing UUIDs | Managing UUIDs | |||
============== | ============== | |||
To create a namespaced UUIDv5: | To create a namespaced UUIDv5: | |||
.. code-block:: yaml+jinja | .. code-block:: yaml+jinja | |||
{{ string | to_uuid(namespace='11111111-2222-3333-4444-555555555555') }} | {{ string | to_uuid(namespace='11111111-2222-3333-4444-555555555555') }} | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 8 lines changed or added |