facter on CentOS 6.5

As far as I can tell, I need to add the EPEL repositories in order to install facter on CentOS.

Am I right?

So far, the only way to install the EPEL repo I have found is to download the rpm for it, and then use rpm to install it. Not something I really want to do every time I run my playbooks.

I also tried yum: name=“http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm” but that said “No Package matching ‘http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm’ found available, installed or updated” even though there’s an example like that in the docs.

So, what’s the best way to install facter on CentOS?

Hi David,

I currently store a copy of the .repo file in a role called baseline that I put at the beginning of every playbook. baseline uses copy to upload the repo file to the boxes and then installs python-keyczar, facter, and adds the appropriate rule to the firewall to open 5099 to the ansible hosts.

All the best,

~ Christopher

You are correct, facter is in the epel repository.

The easiest way to install the epel repository is using a template module to copy over the epel.repo file and a copy module to copy over the Epel GPG key.

Just a tip of ansible newbies, ansible contains it’s own facts system, so there’s no need to install facter or Ruby unless you really want to.

We include the existing facts in there for people who are in the process of migrating playbooks over from Puppet - but in general where there are facts missing, we enjoy pull requests.

It’s also possible to write your own fact modules (just return a dictionary named “ansible_facts” or extend them using the facts.d mechanism - http://docs.ansible.com/playbooks_variables.html#local-facts-facts-d