Skip to content

hash_salt

Collection Note

This module is part of the ansible.netcommon collection. To install the collection, use:

ansible-galaxy collection install ansible.netcommon
Added in version 1.0.0.

Synopsis

  • The filter plugin produces the salt from a hashed password.
  • Using the parameters below - C(password | ansible.netcommon.hash_salt(template.yml))

Parameters

Parameter Defaults / Choices Comments
password
str
required
This source data on which hash_salt invokes.
For example C(password | ansible.netcommon.hash_salt), in this case C(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)