ansible - 无法从具有较旧 ansible 版本和 python 2.x 的 rhel 机器访问 json
问题描述
我正在使用 uri 模块对 api 执行相同的请求/任务。当我在 python 3.7.1 和 ansible 2.8.1 上从 mac 执行时,它可以工作。当我从带有 python 2.7.5 和 ansible 2.4.2.0 的 red hat linux 机器上执行时,它不起作用,我得到了错误'dict object' has no attribute 'json'
这是具有虚拟值的任务:
- name: get request
uri:
url: https://url.com{{ foo }}
method: GET
user: user
validate_certs: False
password: password
return_content: yes
body_format: json
register: page_contents
until: page_contents.json.{{ foo }}[0].status == "deployed"
retries: 30
delay: 5
解决方案
我将 ansible 和 python 版本都更新到了最新版本,现在它工作正常。
推荐阅读
- visual-studio - 无法将 ADO.NET 实体数据模型添加到 .NET Core 2.1 项目
- android - 加载大图像以适应 ImageView
- kubernetes - Openstack Heat 和 Kubernetes 部署集成
- javascript - 显示平铺显示失败的替代图像/平铺(D3 Geo Tiles)
- arrays - 下载远程图像后延迟数据源方法
- java - Spring @Scheduled 执行作业的次数超过预期次数
- python-3.x - 如何在python中维护TransformDict中的键
- sql - SQL 更新连接最大值
- python - 符号链接 /env/.Python 的目标文件不存在于您站点的存储库中
- node.js - Node.js dns.resolve 未返回正确的 IP 地址