ansible:当gather_facts:false时如何访问ansible_env

标签 ansible

我想要进行一次最少的事实收集。我实际上只对访问 ansible_env 中定义的变量感兴趣。

我尝试使用带有过滤器的设置模块:ansible_env和gather_subset:min,但它对我不起作用......

任何提示将不胜感激

谢谢!

最佳答案

您可以执行如下所示的 Ansible 命令来检索特定事实,而不是为此创建剧本:

ansible <hostname> -m setup -a "filter=ansible_distribution"

Source

关于ansible:当gather_facts:false时如何访问ansible_env,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47281300/

相关文章:

Ansible 没有看到 ansible_eth1 设备

automation - Ansible 字典键作为变量

ansible - 使用 ansible 循环访问主机

ansible - 从之前的游戏中获取 ansible_play_hosts 吗?

ansible - 如何在 Ansible 中的多个任务之间共享参数

node.js - 使用 nvm Ansible 安装 Node

ansible - 在 Ansible 中,如何连接到 Windows 主机?

Ansible 塔 REST API : Is there any way to get the logs/output of a job?

python - Ansible:给定变量中的整数列表,定义第二个列表,其中每个元素递增

linux - 如何在ansible命令中提及通配符