.. _ansible.utils.ipcut_filter: ******************* ansible.utils.ipcut ******************* **This filter is designed to get 1st or last few bits of IP address.** Version added: 2.11.0 .. contents:: :local: :depth: 1 Synopsis -------- - This filter is designed to fetch 1st or last few bits of Ip address. Parameters ---------- .. raw:: html
Parameter Choices/Defaults Configuration Comments
amount
integer
integer for arithmetic. Example -1,2,3
value
string / required
list of subnets or individual address or any other values input for ip_cut plugin

Examples -------- .. code-block:: yaml #### examples - name: Get first 64 bits of Ipv6 address debug: msg: "{{ '1234:4321:abcd:dcba::17' | ansible.utils.ipcut(64) }}" - name: Get last 80 bits of Ipv6 address debug: msg: "{{ '1234:4321:abcd:dcba::17' | ansible.utils.ipcut(-80) }}" # PLAY [IPCUT filter plugin examples] ************************************************************************************************ # TASK [Get first X bits of Ipv6 address] ******************************************************************************************** # ok: [localhost] => { # "msg": "1234:4321:abcd:dcba" # } # TASK [Get last X bits of Ipv6 address] ********************************************************************************************* # ok: [localhost] => { # "msg": "dcba:0:0:0:17" # } # PLAY RECAP ************************************************************************************************************************* # localhost : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 Return Values ------------- Common return values are documented `here `_, the following are the fields unique to this filter: .. raw:: html
Key Returned Description
data
string
Returns result of portion of IP.



Status ------ 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.