I have the following value:
stdout_lines: [
[
"iso.3.6.1.2.1.17.4.3.1.1.0.80.121.102.104.4 \"00 50 79 66 68 04 \""
],
[
"iso.3.6.1.2.1.17.4.3.1.1.0.80.121.102.104.6 \"00 50 79 66 68 06 \""
],
[
"iso.3.6.1.2.1.17.4.3.1.1.0.80.121.102.104.8 \"00 50 79 66 68 08 \""
]
]
I want to get the MAC address values in the following form:
00:50:79:66:68:04
00:50:79:66:68:06
00:50:79:66:68:08
That's what I'm trying to do in my playbook:
- set_fact:
mac: "{{ stdout_lines|first|regex_replace(_regex, _replace)|trim }}"
vars:
_regex: '.*"(.*)"'
_replace: '\1'
- set_fact:
matched: "{{ matched|d([]) + [item[2:]|join(':')] }}"
with_items:
- "{{ mac }}"
It turns out some nonsense. What am I doing wrong?