2 changed files with 30 additions and 0 deletions
@ -0,0 +1,21 @@ |
|||
- 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]}') }} |
|||
Loading…
Reference in new issue