…I’m currently having a look at network-engine and so far it looks really promising! Seems like the best solution for network automation there is today However, I’m having trouble parsing a certain configuration on a cisco device:
What I like to achieve is to parse the valuse of “switchport trunk allowed vlan” and all values of “switchport trunk allowed vlan add” into a single fact variable. My currenty code was inspired by the examples for network-engine I could find on the web, but obviously this does not solve my problem:
Thanks for your reply. I finally got it by using your recommendation above. But had to concat/string-replace the 'add ' keyword within that string, which brings me back to my initial question: is it possible to have multiple groups within the regex_match?
e.g.
regex: " switchport trunk allowed (vlan )? (.*)"
...and only use the content of the second group? I tried, but failed ...
"ansible_facts": {
"interface_facts": {
"port-channel99": {
"allowed_vlans": [
"15-19,25-29,35-39,45-49,55-59,65-69",
"85-89,95-99,636,698,752,901,997",
"1104,1119,1999,3800-3810"
],
"description": null
}
}
```
I believe this is what you are looking for.