有什么方法可以对这个Ansible输出进行排序吗?
我尝试使用regex,但仍然显示转义符,并以以下格式显示输出。
- "Description": "nRequested for Details:nnRequested for Name: Maddy
XYZnRequested for Email: abc.def@ghi.comnRequested for Number:
12345678nRequested for Phone: nRequested for Department:
EDUCATIONnRequested for User Domain:nnRequested by
Details:nRequested by Name: Maddy XYZnRequested by Email:
abc.def@ghi.com\nRequested by Employee Number: 12345678nRequested
by Phone: nnRequest Details: nItem: ABC OPERATIONS - Request
FormnCode: ServicesCode: M1N0nEnvironment: nonDescription: 1.
Result is coming as not pass for every applicationn2. additional
descriptionnPriority: HighnRequest and Response (XMLs, JSON):
result is not
passn{"":"NOTFOOUND","":"FULL","AlertsEvalResult":"FULL","identityAlertsEvalResult":"FULL","":{"RptScore":1000,"numInq":0,"RptSourceType":"Intrnl","RptMessages":[{"seqNum":0,"message":"No
File
(L2)"}],"Alerts":null,"":null,"identityAlerts":null,"internalAlerts":[{"code":"500","description":"No
File",
如何以标准格式显示此输出?
谢谢!
我理解您的问题,即您希望以其他格式显示ansible-playbook
输出。
其中的ansible.cfg
中有默认设置
# stdout_callback = yaml
像这样的剧本
---
- hosts: localhost
become: false
gather_facts: false
vars:
text: |
This is:
Some longer example text
with line breaks.
tasks:
- name: Show message
debug:
msg: "{{ text }}"
结果转换为的输出
TASK [Show message] ************************************************************************
ok: [localhost] => {
"msg": "nThis is:nSome longer example textnnwith line breaks.n"
}
设置其他回调插件
stdout_callback = yaml
将导致的yaml化Ansible屏幕输出
TASK [Show message] ********
ok: [localhost] =>
msg: |2-
This is:
Some longer example text
with line breaks.
进一步文档
- 所有回调插件的索引
进一步的问答;A
- 可靠的
stdout
格式 - 显示格式正确的
ansible-playbook
输出 - 以干净格式Ansible显示
debug
输出