【问题标题】:Search for value in variables in AWX在 AWX 中的变量中搜索值
【发布时间】:2019-10-02 08:52:24
【问题描述】:

我正在尝试在 awx 中提出一个主机过滤器查询,该查询能够过滤包含在我的库存变量字段中的键中的值。

我的变量字段如下所示:

{
  "variables": "{..., \"labels\": {\"automation\": \"awx\"}, ...}"
}

我当前的主机过滤器是这样的:

https://my-awx.com/api/v2/hosts/?host_filter=variables__icontains=automation

使用上面的过滤器,我至少能够接收到相应的实例,但是我希望能够过滤超过automation。最终,我希望接收所有 automation 标签具有密钥 awx 的实例,并将它们集成到智能库存中。

还有一个问题:有没有比https://docs.ansible.com/ansible-tower/latest/html/towerapi/filtering.html 更好的文档?我觉得它缺少我的问题中包含的详细信息。

最好的问候, 静止不动

【问题讨论】:

    标签: ansible ansible-inventory ansible-tower ansible-awx


    【解决方案1】:

    根据这个问题:https://github.com/ansible/awx/issues/371 看起来还不支持。

    一个建议的解决方法:

    您可以使用动态脚本或其他方式构建您的库存,并且 然后创建一个将所需主机变量缓存为的剧本 可靠的事实。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-27
      • 1970-01-01
      • 2019-03-18
      相关资源
      最近更新 更多