我有一个针对多个开关运行的游戏并返回以下输出:
- name: show int desc
ios_command:
commands:
- "sh interfaces description | inc {{ mac_addr }}"
register: printout
有没有办法从返回包含字符串“UPLINK”的结果的开关中排除结果?
希望有人能指出我正确的方向,我一直在测试中使用 regex_findall 尝试排除任何包含 UPLINK 的结果,使用:
^((?!UPLINK).)*$
我收到了很多错误,例如: 模板字符串时出现意外模板类型错误或模板错误:意外
IE:不要像这些例子那样显示开关的结果:
ok: [switch20] => {
“printout”: {
“changed”: false,
“failed”: false,
“stdout”: [
“Gi1/0/25 up up UPLINK”
],
“stdout_lines”: [
[
“Gi1/0/25 up up UPLINK”
所以希望它只会显示这个开关:
ok: [switch9] => {
“printout”: {
“changed”: false,
“failed”: false,
“stdout”: [
“Gi1/0/42 up up SEG 12 “
],