# 'ansible\_system\_vendor' is undefined

**URL:** <https://forum.ansible.com/t/ansible-system-vendor-is-undefined/35035>\
**Category:** Ansible Project\
**Created:** [April 22, 2021, 9:59am UTC](https://forum.ansible.com/t/ansible-system-vendor-is-undefined/35035 "2021-04-22T09:59:50Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![cloos](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cloos/32/7297_2.png) [@cloos](https://forum.ansible.com/u/cloos)\
**Post date:** [April 22, 2021, 9:59am UTC](https://forum.ansible.com/t/ansible-system-vendor-is-undefined/35035/1 "2021-04-22T09:59:50Z")

</div>

Hi, we have a playbook that runs once a day on all our Linux hosts.  
On each day, the same task fails on a different host with “‘ansible\_system\_vendor’ is undefined”.  
I know that facts are gathered  
because previous tasks to the failing one are already use facts.

This started after upgrading Ansible from 2.3.3 to 2.10.8.

Any idea why this happens?

Regards Chris

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [April 22, 2021, 2:00pm UTC](https://forum.ansible.com/t/ansible-system-vendor-is-undefined/35035/2 "2021-04-22T14:00:11Z")

</div>

facts are 'best effort' sometimes permissions or a busy system will  
make a specific fact fail, you should get a warning though.

---

<div class="post-metadata">

**Author:** ![cloos](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cloos/32/7297_2.png) [@cloos](https://forum.ansible.com/u/cloos)\
**Post date:** [April 30, 2021, 6:22am UTC](https://forum.ansible.com/t/ansible-system-vendor-is-undefined/35035/3 "2021-04-30T06:22:56Z")

</div>

I can’t find any warning.  
Permissions is also not a problem because we gather facts as root.

The host was also not busy at the time of facts gathering.

Also, if I understand it correctly, facts should be “NA” if they can’t be gathered, and not undefined.

What is also strange is, that it started after using a newer Ansible version (2.10.8).  
We never saw anything like this in your old Ansible version (2.3.3).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [April 30, 2021, 2:55pm UTC](https://forum.ansible.com/t/ansible-system-vendor-is-undefined/35035/4 "2021-04-30T14:55:07Z")

</div>

Sadly not all the facts gathering code consistently uses N/A or  
warnings. But in this case, for system\_vendor, it can be populated by  
either VM detection (hardcoded), query of /sys/devices or executing  
dmidecode (these all seem to use the N/A standard). So afaict you  
should not be getting undefined unless you are using the `subset`  
option.

---

<div class="post-metadata">

**Author:** ![cloos](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cloos/32/7297_2.png) [@cloos](https://forum.ansible.com/u/cloos)\
**Post date:** [May 11, 2021, 8:03am UTC](https://forum.ansible.com/t/ansible-system-vendor-is-undefined/35035/5 "2021-05-11T08:03:23Z")

</div>

That is the point, I’m getting “undefined”.  
So I’m looking for someone who have an idea why I get here “undefined”.

This happens only sometimes when ansible-playbook is run in one of our Jenkins pipelines.  
When I try to reproduce this with the ansible-playbook run from my workstation, no facts are undefined.

I can’t find anything in the target hosts logs, Jenkins logs, or Jenkins host logs.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [May 11, 2021, 1:26pm UTC](https://forum.ansible.com/t/ansible-system-vendor-is-undefined/35035/6 "2021-05-11T13:26:24Z")

</div>

from the code, you don't have access to stat  
/sys/devices/virtual/dmi/id/product\_name (or if you do, you cannot  
access /sys/devices/virtual/dmi/id/sys\_vendor)  
and executing dmidecode it does not provide this info (not installed,  
lack of permissions, etc).

---

<div class="post-metadata">

**Author:** ![cloos](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cloos/32/7297_2.png) [@cloos](https://forum.ansible.com/u/cloos)\
**Post date:** [May 11, 2021, 1:50pm UTC](https://forum.ansible.com/t/ansible-system-vendor-is-undefined/35035/7 "2021-05-11T13:50:20Z")

</div>

As stated before we gather facts as root user, so we have access to /sys/devices/virtual/dmi/id/{product\_name,sys\_vendor}.

Also dmidecode is installed, but is not used because before mentioned paths are accessible.

Also this happens only from time to time on one or two of our hosts (we have 1300 hosts).  
On each ansible-playbook run, different 1 to 2 hosts appear with a undefined ansible\_system\_vendor fact,

sometimes also ansible\_product\_name is undefined.  
Sometimes a ansible-playbook run finishes with no undefined Ansible facts.

And as also stated before, this happened after updating our Ansible from 2.3.3 to 2.10.8.  
We never ever saw this problem with Ansible 2.3.3, which was running fine for years.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [May 11, 2021, 2:54pm UTC](https://forum.ansible.com/t/ansible-system-vendor-is-undefined/35035/8 "2021-05-11T14:54:04Z")

</div>

2.3.3 didn't do timeouts correctly, that might be the reason you are  
seeing this now, but you should also get a warning about it.

---

<div class="post-metadata">

**Author:** ![cloos](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cloos/32/7297_2.png) [@cloos](https://forum.ansible.com/u/cloos)\
**Post date:** [May 11, 2021, 3:30pm UTC](https://forum.ansible.com/t/ansible-system-vendor-is-undefined/35035/9 "2021-05-11T15:30:41Z")

</div>

I just created the following test with a faked lsblk command, because this is called in

[https://github.com/ansible/ansible/blob/devel/lib/ansible/module\_utils/facts/hardware/linux.py#L400](https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts/hardware/linux.py#L400)

- created a /usr/local/bin/lsblk bash script with “sleep 10”

- check that my faked lsblk command is used: which lsblk: /usr/local/bin/lsblk

- set in ansible.cfg “gather\_timeout = 1”

- run “time ansible testhost -b -m setup”, this took 12 seconds, no warning shown

- run “time ansible-playbook facts.yaml -b -l testhost” (facts.yaml is a playbook which just gather facts), his took 12 seconds, no warning shown

I’m sure that my faked lsblk command is used, because when I change the sleep from 10 to 20,  
the ansible and ansible-playbook runs take 22 instead of the previous 12 seconds.

I would expect a warning from the above ansible and ansible-playbook runs, but nothing is shown.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [May 12, 2021, 3:46pm UTC](https://forum.ansible.com/t/ansible-system-vendor-is-undefined/35035/10 "2021-05-12T15:46:12Z")

</div>

probably related to this then [https://github.com/ansible/ansible/issues/74657](https://github.com/ansible/ansible/issues/74657)

---

<div class="post-metadata">

**Author:** ![cloos](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cloos/32/7297_2.png) [@cloos](https://forum.ansible.com/u/cloos)\
**Post date:** [May 26, 2021, 10:09am UTC](https://forum.ansible.com/t/ansible-system-vendor-is-undefined/35035/11 "2021-05-26T10:09:00Z")

</div>

I have applied your patch from [https://github.com/ansible/ansible/issues/74657#issuecomment-841457582](https://github.com/ansible/ansible/issues/74657#issuecomment-841457582)  
and beside the fake lsblk I also created a fake udevadm (sleep 10) because this is called in \_udevadm\_uuid ([https://github.com/ansible/ansible/blob/953aa26286db433c3509785e24f89f6616233841/lib/ansible/module\_utils/facts/hardware/linux.py#L440-L463](https://github.com/ansible/ansible/blob/953aa26286db433c3509785e24f89f6616233841/lib/ansible/module_utils/facts/hardware/linux.py#L440-L463))  
which is called in get\_mount\_info ([https://github.com/ansible/ansible/blob/953aa26286db433c3509785e24f89f6616233841/lib/ansible/module\_utils/facts/hardware/linux.py#L516-L525](https://github.com/ansible/ansible/blob/953aa26286db433c3509785e24f89f6616233841/lib/ansible/module_utils/facts/hardware/linux.py#L516-L525))

and then re-run the steps from my above comment and even then don’t get a timeout warning.

---

<div class="post-metadata">

**Author:** ![cloos](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cloos/32/7297_2.png) [@cloos](https://forum.ansible.com/u/cloos)\
**Post date:** [May 26, 2021, 10:23am UTC](https://forum.ansible.com/t/ansible-system-vendor-is-undefined/35035/12 "2021-05-26T10:23:43Z")

</div>

I think [https://github.com/ansible/ansible/blob/953aa26286db433c3509785e24f89f6616233841/lib/ansible/module\_utils/facts/hardware/linux.py#L584-L588](https://github.com/ansible/ansible/blob/953aa26286db433c3509785e24f89f6616233841/lib/ansible/module_utils/facts/hardware/linux.py#L584-L588) is missing a :  
self.module.warn(“Timed out while attempting to get extra information.”)

---

<div class="post-metadata">

**Author:** ![cloos](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cloos/32/7297_2.png) [@cloos](https://forum.ansible.com/u/cloos)\
**Post date:** [June 8, 2021, 6:57am UTC](https://forum.ansible.com/t/ansible-system-vendor-is-undefined/35035/13 "2021-06-08T06:57:20Z")

</div>

I have applied the changes from [https://github.com/ansible/ansible/pull/74714](https://github.com/ansible/ansible/pull/74714) and [https://github.com/ansible/ansible/pull/74885](https://github.com/ansible/ansible/pull/74885)  
and now see the same KeyError as in [https://github.com/ansible/ansible/pull/74714#pullrequestreview-673126168](https://github.com/ansible/ansible/pull/74714#pullrequestreview-673126168)  
which seams to be fixed in [https://github.com/ansible/ansible/pull/74791](https://github.com/ansible/ansible/pull/74791)

Thanks Brian for helping debugging this.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [June 8, 2021, 8:16am UTC](https://forum.ansible.com/t/ansible-system-vendor-is-undefined/35035/14 "2021-06-08T08:16:02Z")

</div>

Expected, the 2 first are meant to show better errors and allow for  
debugging, while the last one fixes concurrency issues with threads  
for modules that call run\_command.

---

<div class="post-metadata">

**Author:** ![cloos](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cloos/32/7297_2.png) [@cloos](https://forum.ansible.com/u/cloos)\
**Post date:** [June 8, 2021, 8:33am UTC](https://forum.ansible.com/t/ansible-system-vendor-is-undefined/35035/15 "2021-06-08T08:33:48Z")

</div>

One last question regarding this:  
[https://github.com/ansible/ansible/pull/74791](https://github.com/ansible/ansible/pull/74791) is currently labeled with affects\_2.12, so do we have to wait for 2.12 or will this fix back ported to 2.11 and 2.10?
