You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
830 B
21 lines
830 B
- name: Split filter
|
|
hosts: localhost
|
|
gather_facts: no
|
|
tasks:
|
|
- block:
|
|
- debug:
|
|
var: output
|
|
- assert:
|
|
that:
|
|
- output | length == 4
|
|
- "output[1] | length == 4"
|
|
vars:
|
|
input:
|
|
- " Name MAC address Protocol Address"
|
|
- "-------------------------------------------------------------------------------"
|
|
- " lo 00:00:00:00:00:00 ipv4 127.0.0.1/8"
|
|
- " lo 00:00:00:00:00:00 ipv6 ::1/128"
|
|
- " enp1s0 02:02:01:00:01:66 ipv4 192.168.1.195/24"
|
|
- " enp1s0 02:02:01:00:01:66 ipv6 fe80::7ef3:9a60:321:2091/64"
|
|
output: >
|
|
{{ input[2:] | map("split", None) | community.general.json_query('[*].{"ifname": [0], "mac": [1], "proto": [2], "address": [3]}') }}
|
|
|