Ansible setup facts - system vendor on RHEL5

Hi

As discussed in IRC, it seems that Ansible cannot determine system vendor on RHEL5 based OS. Reason is simple: on RHEL5 there is no /sys/devices/virtual/dmi/id/ directory. Since I need that fact, I did small hack in setup module and I get this fact this way:

/usr/sbin/dmidecode -s system-product-name

AFAIK this method is compatible with all Linux distros (I checked RHEL5, RHEL6, Linux Mint). It can determine vendor be it physical or virtual (VMWare, oVirt etc).

Since this method is more general and portable, perhaps you should use this one instead of reading /sys/devices/virtual/dmi/id/sys_vendor

Thanks
Edgars

I think the issue here is that it requires the dmidecode package to be installed on the host. This is probably quite unsavoury to some.

Discussed before on Github in the early days of the project:

     https://github.com/ansible/ansible/issues/376

There's no issue with having dmidecode for systems not having the proper sysfs entries, however it should not be implemented as the default.

Makes sense, so this needs to be a new feature request?

I think Michael prefers a support ticket (http://www.ansibleworks.com/subscriptions/) or a pull request (https://github.com/ansible/ansible/pulls) :slight_smile:

I'll see if I can produce something for this, we'd like to avoid forking more than one dmidecode call. I guess python-dmidecode might be a better solution for people wanting this (on their targets). python-dmidecode is available in RHEL5.5 (or from EPEL).

To slightly correct dag, I *do* take feature requests, but there's
obviously a bit of a backlog.

My immediate priority is bringing everyone ansible-commander, so a
pull request that actually adds a feature is much more likely to get
immediate traction.

It's definitely not true that you can't share an idea if you aren't
paying us, I don't want folks thinking that :slight_smile:

--Michael

Right, I didn't wanted to imply that.

+1 for python-dmidecode. calling dmidecode and parsing the output is ugly :wink:

-ap

python-dmidecode implementation (for RHEL5.5+) exists at:

     https://github.com/ansible/ansible/pull/2479

A pure dmidecode implementation has yet to be written.

I think I'm inclined to *not* rely on python-dmidecode being installed
because most people will simply not install it, and thus will be
missing those facts.

Which is the same for dmidecode, which is not part of a standard/minimal install on RHEL5.

I am not sure what you mean with 'not rely', you mean you don't want to add the added complexity to the setup module ?

I mean people won't remember to install it.

Though you have a point if dmidecode itself isn't stock, it matters not so much.

If we have a choice between install python-dmidecode or not to have these facts at all, then installing additional package seems reasonable requirement.

Edgars

yep.

It seems that version 1.2 still cannot determine system vendor for RHEL5, even though I have both dmidecode and python-dmidescode packages installed

Edgars

so, I had to replace:

self.facts[‘system_vendor’] = execute(‘dmidecode -s system-manufacturer’) or ‘NA’

with:

self.facts[‘system_vendor’] = execute(‘/usr/sbin/dmidecode -s system-manufacturer’) or ‘NA’

and now it works!

Edgars

Ah ok, we need to make this use the find binary code in lib/ansible/module_common.

Can you please file a ticket so we don’t forget this?

Thanks!