- name: convert IPv6 addresses into IPv4 addresses.
debug:
msg: "{{ value|ansible.utils.ipv6('ipv4') }}"
- name: filter only IPv6 addresses.
debug:
msg: "{{ value|ansible.utils.ipv6('address') }}"
# PLAY [Ipv6 filter plugin with different queries.] ******************************************************************
# TASK [Set value as input list] ***************************************************************************************
# ok: [localhost] => {
# "ansible_facts": {
# "value": [
# "192.24.2.1",
# "::ffff:192.168.32.0/120",
# "",
# "::ffff:192.24.2.1/128",
# "192.168.32.0/24",
# "fe80::100/10",
# true
# ]
# },
# "changed": false
# }
#
# TASK [IPv6 filter to filter Ipv6 Address] ****************************************************************************
# ok: [localhost] => {
# "msg": [
# "::ffff:192.168.32.0/120",
# "::ffff:192.24.2.1/128",
# "fe80::100/10"
# ]
# }
#
# TASK [convert IPv6 addresses into IPv4 addresses.] *******************************************************************
# ok: [localhost] => {
# "msg": [
# "192.168.32.0/24",
# "192.24.2.1/32"
# ]
# }
#
# TASK [filter only IPv6 addresses] *******************************************************************
# ok: [localhost] => {
# "msg": [
# "::ffff:192.168.32.0",
# "::ffff:192.24.2.1",
# "fe80::100"
# ]
# }
#
Return Values
-------------
Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this filter:
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.