community.general.hashids_encode filter – Encodes YouTube-like hashes from a sequence of integers

Note

This filter plugin is part of the community.general collection (version 6.6.2).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.hashids_encode.

New in community.general 3.0.0

Synopsis

  • Encodes YouTube-like hashes from a sequence of integers.

Input

This describes the input of the filter, the value before | community.general.hashids_encode.

Parameter

Comments

Input

list / elements=integer / required

A list of integers.

Keyword parameters

This describes keyword parameters of the filter. These are the values key1=value1, key2=value2 and so on in the following example: input | community.general.hashids_encode(key1=value1, key2=value2, ...).

Parameter

Comments

alphabet

list / elements=string

String of 16 or more unique characters to produce a hash.

min_length

integer

Minimum length of hash produced.

salt

string

String to use as salt when hashing.

Default: "excel"

Examples

- name: Convert list of integers to hash
  ansible.builtin.debug:
    msg: "{{ [1, 2, 3] | community.general.hashids_encode }}"
    # Produces: 'o2fXhV'

Return Value

Key

Description

Return value

string

A YouTube-like hash.

Returned: success

Authors

  • Andrew Pantuso (@Ajpantuso)

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.