Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ansible facts missing when there is a failed iSCSI path, e.g ansible_system_vendor #77037

Open
1 task done
brsanche opened this issue Feb 16, 2022 · 3 comments
Open
1 task done
Labels
affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_verified This issue needs to be verified/reproduced by maintainer P3 Priority 3 - Approved, No Time Limitation support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@brsanche
Copy link

Summary

Ansible facts missing when there is a failed iSCSI path, e.g ansible_system_vendor

Issue Type

Bug Report

Component Name

ansible.builtin.setup module

Ansible Version

$ ansible --version
ansible 2.9.25

Configuration

$ ansible-config dump --only-changed
[defaults]
forks          = 20
roles_path    = roles/
host_key_checking = False
vault_password_file = ./.vault_pass
deprecation_warnings = False
command_warnings = False
retry_files_enabled = False
[inventory]
[privilege_escalation]
become=True
[paramiko_connection]
host_key_auto_add = True
[ssh_connection]
ssh_args = -q -C -o ControlMaster=auto -o ControlPersist=28800
ssh_extra_args = -K
control_path_dir = ~/.ansible/cp
control_path = %(directory)s/%%h-%%r
pipelining = True
[persistent_connection]
[accelerate]
[selinux]
[colors]
[diff]

OS / Environment

Red Hat Enterprise Linux release 8.4 (Ootpa)

Steps to Reproduce

e.g missing ansible_system_vendor

sys_vendor information present on output from affected host:

$ cat /sys/devices/virtual/dmi/id/sys_vendor
VMware, Inc. 
$ sudo dmidecode -s system-manufacturer
VMware, Inc.

Affected host setup module run:

$ ansible.builtin.setup -a 'filter=ansible_system_vendor'
{
  "ansible_facts": {
    "discovered_interpreter_python": "/usr/libexec/platform-python"
  },
  "changed": false
}

The same filter on another machine return correctly:

$ ansible.builtin.setup -a 'filter=ansible_system_vendor'
{
  "ansible_facts": {
    "ansible_system_vendor": "VMware, Inc.",
    "discovered_interpreter_python": "/usr/libexec/platform-python"
  },
  "changed": false
}

While running the setup module with -vvv we do see the following error:

xxxxxxxxxxxxxxxxxx> ESTABLISH SSH CONNECTION FOR USER: xxxxxxxx
xxxxxxxxxxxxxxxxxx> SSH: EXEC ssh -q -C -o ControlMaster=auto -o 'ControlPath=~/.xxxxxxxxxxxxxxxxxx '/bin/sh -c '"'"'sudo -H -S -n  -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-csuhjlytofpjyuecsqoduwnqmjjitqse ; /usr/libexec/platform-python /home/xxxxxxxx/.ansible/tmp/ansible-tmp-1644590301.93-27392-221657458962224/AnsiballZ_setup.py'"'"'"'"'"'"'"'"' && sleep 0'"'"''
Escalation succeeded
xxxxxxxxxxxxxxxxxx> (0, 'FileNotFoundError(2, \'No such file or directory\')\r\n\r\n{"ansible_facts": {}, "invocation": {"module_args": {"filter": "ansible_system_vendor", "gather_subset": ["all"], "gather_timeout": 10, "fact_path": "/etc/ansible/facts.d"}}}\r\n', '')

Assumption here is that issue could be related to the missing iSCSI path:

$ grep -B10 "host35" debug.txt
...
/tmp/ansible_ansible.builtin.setup_payload_f73nzx6q/ansible_ansible.builtin.setup_payload.zip/ansible/module_utils/facts/hardware/linux.py(92)populate()->None
-> device_facts = self.get_device_facts()
(Pdb) FileNotFoundError: [Errno 2] No such file or directory: '/sys/block/../devices/platform/host35/session3/target35:0:0/35:0:0:1/block/sdb'
> /tmp/ansible_ansible.builtin.setup_payload_f73nzx6q/ansible_ansible.builtin.setup_payload.zip/ansible/module_utils/facts/hardware/base.py(64)collect()
-> facts_dict = facts_obj.populate(collected_facts=collected_facts)
(Pdb) --Return--
> /tmp/ansible_ansible.builtin.setup_payload_f73nzx6q/ansible_ansible.builtin.setup_payload.zip/ansible/module_utils/facts/hardware/base.py(64)collect()->None
-> facts_dict = facts_obj.populate(collected_facts=collected_facts)
(Pdb) FileNotFoundError: [Errno 2] No such file or directory: '/sys/block/../devices/platform/host35/session3/target35:0:0/35:0:0:1/block/sdb'
> /tmp/ansible_ansible.builtin.setup_payload_f73nzx6q/ansible_ansible.builtin.setup_payload.zip/ansible/module_utils/facts/collector.py(101)collect_with_namespace()
-> facts_dict = self.collect(module=module, collected_facts=collected_facts)
(Pdb) --Return--
> /tmp/ansible_ansible.builtin.setup_payload_f73nzx6q/ansible_ansible.builtin.setup_payload.zip/ansible/module_utils/facts/collector.py(101)collect_with_namespace()->None
-> facts_dict = self.collect(module=module, collected_facts=collected_facts)
(Pdb) FileNotFoundError: [Errno 2] No such file or directory: '/sys/block/../devices/platform/host35/session3/target35:0:0/35:0:0:1/block/sdb'

Expected Results

All ansible_facts should be showing according to the gather_subset sellected.

Actual Results

Missing `ansible_system_vendor` on setup module output.

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot
Copy link
Contributor

ansibot commented Feb 16, 2022

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Feb 16, 2022
@nitzmahone nitzmahone removed the needs_triage Needs a first human triage before being processed. label Feb 17, 2022
@nitzmahone
Copy link
Member

Failures during fact gathering around iscsi devices has been made a bit more robust in newer Ansible releases- can you try this with 2,12+ and see if it behaves better?

@s-hertel s-hertel added P3 Priority 3 - Approved, No Time Limitation needs_verified This issue needs to be verified/reproduced by maintainer labels Aug 3, 2022
@Akasurde
Copy link
Member

@brsanche Can you please check if the problem still persists with latest Ansible versions? Thanks in advance.

needs_info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_verified This issue needs to be verified/reproduced by maintainer P3 Priority 3 - Approved, No Time Limitation support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

No branches or pull requests

5 participants