我有一个Ansible任务,它向网站发出URI请求以获得JSON响应。如果定义了嵌套的JSON变量,我希望Ansible能够做一些事情,如果没有定义嵌套的JSON变量,我希望Ansible做一些其他的事情。- name: Get JSON from the Interwebs
uri: url="http://whatever.com/jsonresponse"
我对ansible中的循环和failed_with有问题。我也不知道原因。实际的failed_when要复杂得多,我知道在这种情况下我可以使用status_code。我的目标是将来自本地api的json响应解析为多个(我从api中早期获得的动态列表)对象,如果它不是我期望的响应,则失败。- name: "get status for items" url: https://{{inventory_hostname}}/
在响应中,我得到一个“未决”或"IN_PROGRESS“作为request_status。我想等到我得到一个“完成”或“失败”。时等待 - name: Wait for the cluster deployment (this will take a while) method: GET password: admin
HEADER_X-Requested-By:
在本例中,我尝试为(CallOne,CallTwo)创建API,我应该寻找哪种类型的循环?我尝试过嵌套的forloop,但是我不能让循环依赖起作用,我不确定ansible是否支持这样的循环。- name: API - callOne url: "https://localhost/api/commands/callOne" userregister: callOne
d