Hi all,
So I know a lot of you like to run relatively minimal nodes and often
don't need a Ruby interpreter, except that (until now) if you wanted
things like facter and ohai gave you, you had to run Ohai and facter
to get information about the host to bubble up.
This has now changed with an excellent patch from Stephen Fromm (now
available on the integration branch)
You can use these variables (see below) in both action lines and
templates, and I will soon update the web page to reflect this.
You get a lot of top level facts like below, all prefixed with
"ansible_". Note that the setup module still gets facts from facter
and ohai if you have them installed, (facter also requires
rubygem-json), so technically you could intermix all three if you
really wanted..
Stephen and I have decided to just concentrate on the core facts most
people need at first, but we can take patches to take more.
Keep in mind these must be cross platform, so the second any of these
don't work on your OS, please file a ticket. It is ok if some
facts aren't available on all platforms, but for every Unix/Linux
platform, I expect the ansible setup module to still work perfectly.
Testing welcome. Easiest way to test is just:
ansible all -m setup
Or just use a playbook
And then look at /etc/ansible/setup to see what variables it determined
You should see stuff like:
{
"ansible_architecture": "x86_64",
"ansible_distribution": "CentOS",
"ansible_distribution_release": "Final",
"ansible_distribution_version": "6.2",
"ansible_eth0": {
"ipv4": {
"address": "REDACTED",
"netmask": "255.255.255.0"
},
"ipv6": [
{
"address": "REDACTED",
"prefix": "64",
"scope": "link"
}
],
"macaddress": "REDACTED"
},
"ansible_form_factor": "Other",
"ansible_fqdn": "localhost.localdomain",
"ansible_hostname": "localhost",
"ansible_interfaces": [
"lo",
"eth0"
],
"ansible_kernel": "2.6.32-220.2.1.el6.x86_64",
"ansible_lo": {
"ipv4": {
"address": "127.0.0.1",
"netmask": "255.0.0.0"
},
"ipv6": [
{
"address": "::1",
"prefix": "128",
"scope": "host"
}
],
"ansible_machine": "x86_64",
"ansible_memfree_mb": 89,
"ansible_memtotal_mb": 993,
"ansible_processor": [
"Intel(R) Core(TM) i7-2677M CPU @ 1.80GHz"
],
"ansible_processor_cores": "NA",
"ansible_processor_count": 1,
"ansible_product_name": "VMware Virtual Platform",
"ansible_product_serial": "REDACTED",
"ansible_product_uuid": "REDACTED",
"ansible_product_version": "None",
"ansible_python_version": "2.6.6",
"ansible_product_version": "None",
"ansible_python_version": "2.6.6",
"ansible_ssh_host_key_dsa_public": REDACTED",
"ansible_ssh_host_key_rsa_public": "REDACTED",
"ansible_swapfree_mb": 1822,
"ansible_swaptotal_mb": 2015,
"ansible_system": "Linux",
"ansible_system_vendor": "VMware, Inc.",
"ansible_virtualization_role": "None",
"ansible_virtualization_type": "None",
Thanks Stephen for a really awesome addition!
--Michael