ansible.builtin.to_uuid filter – namespaced UUID generator
Note
This filter plugin is part of ansible-core
and included in all Ansible
installations. In most cases, you can use the short
plugin name
to_uuid
.
However, we recommend you use the Fully Qualified Collection Name (FQCN) ansible.builtin.to_uuid
for easy linking to the
plugin documentation and to avoid conflicting with other collections that may have
the same filter plugin name.
New in Ansible 2.9
Synopsis
Use to generate namespaced Universal Unique ID.
Input
This describes the input of the filter, the value before | ansible.builtin.to_uuid
.
Parameter |
Comments |
---|---|
String to use as base fo the UUID. |
Positional parameters
This describes positional parameters of the filter. These are the values positional1
, positional2
and so on in the following
example: input | ansible.builtin.to_uuid(positional1, positional2, ...)
Parameter |
Comments |
---|---|
UUID namespace to use. Default: |
Examples
# To create a namespaced UUIDv5
uuid: "{{ string | to_uuid(namespace='11111111-2222-3333-4444-555555555555') }}"
# To create a namespaced UUIDv5 using the default Ansible namespace '361E6D51-FAEC-444A-9079-341386DA8E2E'
uuid: "{{ string | to_uuid }}"
Return Value
Key |
Description |
---|---|
Generated UUID. Returned: success |
Hint
Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.