简体   繁体   English

Ansible Facter-CentOS-不显示任何facter_变量

[英]Ansible facter - CentOS - not showing any facter_ variables

I have two boxes: 我有两个盒子:
- CentOS 7.2.xx vagrant box -CentOS 7.2.xx流浪者盒子
and
- Debian/Ubuntu 14.04 trusty vagrant box -Debian / Ubuntu 14.04可信任的无用物品盒

On both, I installed Ansible (using their preferred package manager method) and ansible/ansible-playbook commands are working perfectly on both boxes. 在两者上,我都安装了Ansible(使用其首选的包管理器方法),并且ansible / ansible-playbook命令在这两个盒子上均能正常工作。

On CentOS box, installed Ansible version is: 在CentOS盒子上,已安装的Ansible版本是:

$ ansible --version
ansible 2.1.2.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides

On Ubuntu box, installed Ansible version is: 在Ubuntu盒子上,已安装的Ansible版本为:

ansible 2.2.0.0

On both Ubuntu and CentOS vagrant boxes, When I'm running the following command, it works! 在Ubuntu和CentOS流浪者盒子上,当我运行以下命令时,它起作用了! ie it's spitting out a lot of JSON formatted output hash/values., great: 即,它吐出了许多JSON格式的输出哈希/值。

[vagrant@ip-10-11-12-13 ~/aks/workspace] $ ansible all -m setup -i "`hostname`," --connection=local 


Now, as I'm specifically looking for 'facter_ someVar' variables (which can give me some meaningful information about the local box), so I tried to grep --> "facter_" word from the output of the previous command. 现在,我专门找“facter_ someVar”变量(可以给我讲述了当地框中键入一些有意义的信息),所以我试图给grep -从先前命令的输出>“facter_”字。

[vagrant@ip-10-11-12-13 ~/aks/workspace] $ ansible all -m setup -i "`hostname`," --connection=local | grep "facter_"
[vagrant@ip-10-11-12-13 ~/aks/workspace] $

I found that on Ubuntu box, it's showing me a lot of facter_xxxx matching variables (around 71+), but on CentOS box, I'm NOT getting ANY facter_ variable in the output? 我发现在Ubuntu盒子上,它向我展示了很多facter_xxxx匹配变量(大约71+),但是在CentOS盒子上,我没有在输出中得到任何 facter_变量吗?

I recall, in past, I have used CentOS boxes (vagrant provisioned) and they all showed facter_ variables. 我记得,过去我使用过CentOS框(提供了无用的配置),它们都显示了facter_变量。

I know there are similar 'ansible_ someVar' variables but I'm curious about why facter_xxxxx variables are not showing up here. 我知道也有类似的'ansible_ someVar'变量,但是我很好奇为什么不显示facter_xxxxx变量。

OK, I was missing facter package on my other box. 好的,我在另一个盒子上缺少Facter软件包。 The following solved the issue (you may need to get the respective EPEL repo). 以下解决了该问题(您可能需要获取相应的EPEL存储库)。

sudo yum install facter

Facter is small program that gathers system information such as hardware details, network settings, virtualisation type and kernel/OS information. Facter是一个小型程序,可收集系统信息,例如硬件详细信息,网络设置,虚拟化类型和内核/ OS信息。 Seems like Facter was created for Puppet to gather system information (but is also available as a standalone command) so it was not installed for free on the particular vagrant CentOS image I used. 好像Facter是为Puppet创建的,用于收集系统信息(但也可以作为独立命令使用),因此并未将其免费安装在我使用的特定Vagrant CentOS映像上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM