简体   繁体   中英

Ansible facter - CentOS - not showing any facter_ variables

I have two boxes:
- CentOS 7.2.xx vagrant box
and
- Debian/Ubuntu 14.04 trusty vagrant box

On both, I installed Ansible (using their preferred package manager method) and ansible/ansible-playbook commands are working perfectly on both boxes.

On CentOS box, installed Ansible version is:

$ 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:

ansible 2.2.0.0

On both Ubuntu and CentOS vagrant boxes, When I'm running the following command, it works! ie it's spitting out a lot of JSON formatted output hash/values., great:

[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.

[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?

I recall, in past, I have used CentOS boxes (vagrant provisioned) and they all showed facter_ variables.

I know there are similar 'ansible_ someVar' variables but I'm curious about why facter_xxxxx variables are not showing up here.

OK, I was missing facter package on my other box. The following solved the issue (you may need to get the respective EPEL repo).

sudo yum install facter

Facter is small program that gathers system information such as hardware details, network settings, virtualisation type and kernel/OS information. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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