community.general.hashids_encode 过滤器 – 从整数序列编码类似 YouTube 的哈希值
注意
此过滤器插件是 community.general 集合 (版本 10.1.0) 的一部分。
如果您使用的是 ansible 包,则可能已安装此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install community.general。
要在 playbook 中使用它,请指定:community.general.hashids_encode。
community.general 3.0.0 中的新增功能
概要
- 从整数序列编码类似 YouTube 的哈希值。 
输入
这描述了过滤器的输入,即 | community.general.hashids_encode 之前的数值。
| 参数 | 注释 | 
|---|---|
| 一个整数列表。 | 
关键字参数
这描述了过滤器的关键字参数。这些是在以下示例中的 key1=value1、key2=value2 等值:input | community.general.hashids_encode(key1=value1, key2=value2, ...)
| 参数 | 注释 | 
|---|---|
| 包含 16 个或更多唯一字符的字符串,用于生成哈希值。 | |
| 生成的哈希值的最小长度。 | |
| 哈希时用作盐的字符串。 默认值:  | 
示例
- name: Convert list of integers to hash
  ansible.builtin.debug:
    msg: "{{ [1, 2, 3] | community.general.hashids_encode }}"
    # Produces: 'o2fXhV'
返回值
| 键 | 描述 | 
|---|---|
| 类似 YouTube 的哈希值。 返回:成功 | 
