[英]How to Parse the url data from ansible JSON output and extract the data
我正在处理AWX
ansible 查询,我从查询中得到 output,我需要的数据采用 URL 格式,即
'dn': "uni/infra/funcprof/accportgrp-xxxxxxxxxx/rtaccBaseGrp-[uni/infra/accportprof-xxxxxxxxxxxx/hports-xxxxxx-typ-range]"
我想从 ansible 中的上述字符串中提取'xxxx'
数据。 我可以在 python 中使用/
拆分它并获取详细信息。 想知道如何在 Ansible 中做到这一点?
使用名为 mystring 的变量中的字符串:您可以执行以下操作:
{{ mystring.split("/")[1] | lower }}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.