Skip to content

Latest commit

 

History

History
151 lines (117 loc) · 4.55 KB

ansible.utils.ip4_hex_filter.rst

File metadata and controls

151 lines (117 loc) · 4.55 KB

ansible.utils.ip4_hex

This filter is designed to convert IPv4 address to Hexadecimal notation with optional delimiter.

Version added: 2.5.0

  • This filter convert IPv4 address to Hexadecimal notation with optional delimiter
Parameter Choices/Defaults Configuration Comments
arg
string / required
IPv4 address.
delimiter
string
Default:
""
You can provide a single argument to each ip4_hex() filter as delimiter.

#### examples
# ip4_hex convert IPv4 address to Hexadecimal notation with optional delimiter
- debug:
    msg: "{{ '192.168.1.5' | ansible.utils.ip4_hex }}"

# ip4_hex with delimiter
- debug:
    msg: "{{ '192.168.1.5' | ansible.utils.ip4_hex(':') }}"

# TASK [debug] ************************************************************************************************
# task path: /Users/amhatre/ansible-collections/playbooks/test_ip4_hex.yaml:7
# Loading collection ansible.utils from /Users/amhatre/ansible-collections/collections/ansible_collections/ansible/utils
# ok: [localhost] => {
#     "msg": "c0a80105"
# }
#
# TASK [debug] ************************************************************************************************
# task path: /Users/amhatre/ansible-collections/playbooks/test_ip4_hex.yaml:11
# Loading collection ansible.utils from /Users/amhatre/ansible-collections/collections/ansible_collections/ansible/utils
# ok: [localhost] => {
#     "msg": "c0:a8:01:05"
# }

Common return values are documented here, the following are the fields unique to this filter:

Key Returned Description
data
string
Returns IPv4 address to Hexadecimal notation.



Authors

  • Ashwini Mhatre (@amhatre)

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.