ansible.netcommon.hash_salt filter – The hash_salt filter plugin.

Note

This filter plugin is part of the ansible.netcommon collection (version 7.1.0).

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 ansible.netcommon.

To use it in a playbook, specify: ansible.netcommon.hash_salt.

New in ansible.netcommon 1.0.0

Synopsis

  • The filter plugin produces the salt from a hashed password.

  • Using the parameters below - password | ansible.netcommon.hash_salt(template.yml)

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 | ansible.netcommon.hash_salt(key1=value1, key2=value2, ...)

Parameter

Comments

password

string / required

This source data on which hash_salt invokes.

For example password | ansible.netcommon.hash_salt, in this case password represents the hashed password.

Notes

Note

  • The filter plugin produces the salt from a hashed password.

Examples

# Using hash_salt

# playbook

- name: Set the facts
  ansible.builtin.set_fact:
    password: "$1$avs$uSTOEMh65ADDBREAKqzvpb9yBMpzd/"

- name: Invoke hash_salt
  ansible.builtin.debug:
    msg: "{{ password | ansible.netcommon.hash_salt() }}"


# Task Output
# -----------
#
# TASK [Set the facts]
# ok: [host] => changed=false
#   ansible_facts:
#     password: $1$avs$uSTOEMh65ADDBREAKqzvpb9yBMpzd/

# TASK [Invoke hash_salt]
# ok: [host] =>
#   msg: avs

Authors

  • Ken Celenza (@itdependsnetworks)

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.