ansible.utils.ipv6form filter – This filter is designed to convert ipv6 address in different formats. For example expand, compressetc.
Note
This filter plugin is part of the ansible.utils collection (version 4.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.utils
.
To use it in a playbook, specify: ansible.utils.ipv6form
.
New in ansible.utils 2.11.0
Synopsis
This filter is designed to convert ipv6 addresses in different formats.
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.utils.ipv6form(key1=value1, key2=value2, ...)
Examples
#### examples
# Ipv6form filter plugin with different format.
- name: Expand given Ipv6 address
debug:
msg: "{{ '1234:4321:abcd:dcba::17' | ansible.utils.ipv6form('expand') }}"
- name: Compress given Ipv6 address
debug:
msg: "{{ '1234:4321:abcd:dcba:0000:0000:0000:0017' | ansible.utils.ipv6form('compress') }}"
- name: Covert given Ipv6 address in x509
debug:
msg: "{{ '1234:4321:abcd:dcba::17' | ansible.utils.ipv6form('x509') }}"
# TASK [Expand given Ipv6 address] ************************************************************************************
# task path: /home/amhatre/dev/playbook/test_ipform.yaml:7
# Loading collection ansible.utils from /home/amhatre/dev/collections/ansible_collections/ansible/utils
# ok: [localhost] => {
# "msg": "1234:4321:abcd:dcba:0000:0000:0000:0017"
# }
# TASK [Compress given Ipv6 address] *********************************************************************************
# task path: /home/amhatre/dev/playbook/test_ipform.yaml:11
# Loading collection ansible.utils from /home/amhatre/dev/collections/ansible_collections/ansible/utils
# ok: [localhost] => {
# "msg": "1234:4321:abcd:dcba::17"
# }
# TASK [Covert given Ipv6 address in x509] ****************************************************************************
# task path: /home/amhatre/dev/playbook/test_ipform.yaml:15
# Loading collection ansible.utils from /home/amhatre/dev/collections/ansible_collections/ansible/utils
# ok: [localhost] => {
# "msg": "1234:4321:abcd:dcba:0:0:0:17"
# }
# PLAY RECAP **********************************************************************************************************
# localhost : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0