问题描述
- hosts: localhost
gather_facts: no
vars:
output: |
Routing entry for 2001:506:4200:4000::/50
Known via "static",distance 1,metric 0 (connected)
Installed Aug 12 12:39:44.252 for 8w6d
Routing Descriptor Blocks
directly connected,via Null0
Route metric is 0,Wt is 1
No advertising protos.
tasks:
- set_fact:
parse: "{{ output | map('regex_replace','Routing entry for (25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).*','Routing Entry: ') }}"
不确定正则表达式替换功能中发生了什么
如果一个对象匹配,我就可以处理其他对象,则任何线索都会受到赞赏
我希望以以下格式获取输出:
{
'Routing': '2001:506:4200:4000::/50','Installed': 'Aug 12 12:39:44.252','directly connected': 'via Null0','Route metric': '0'
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)