【问题标题】:The following modules failed to execute: ansible.legacy.setup?以下模块无法执行:ansible.legacy.setup?
【发布时间】:2023-01-24 06:23:28
【问题描述】:

我正在尝试使用 Dell OpenManage Ansible 模块与 PowerEdge 的 iDRAC 进行通信。我无法在网上找到解决我的问题的方法,希望这里有人能够提供帮助。我找到的唯一真正的答案是主机可能没有使用 Python,但正如您从下面的错误中看到的那样,主机实际上正在使用 Python 解释器。它与我运行剧本的虚拟环境中的解释器并不完全相同,我不确定这是否有所作为。

设备: PowerEdge R620 和 iDRAC7

剧本:

---
- hosts: PowerEdge
  connection: local
  gather_facts: False

  tasks:
  - name: Get hardware inventory
    dellemc_get_system_inventory:
      idrac_ip:  "IP"
      idrac_user:  "USER"
      idrac_password:  "PASSWORD"
      validate_certs: false
    become: yes

命令:

ansible-playbook playbook.yml -i iDRAC_IP, -u USER --ask-pass -vvv -K

错误:

fatal: [iDRAC_IP]: FAILED! => {
    "ansible_facts": {},
    "changed": false,
    "failed_modules": {
        "ansible.legacy.setup": {
            "ansible_facts": {
                "discovered_interpreter_python": "/usr/bin/python"
            },
            "failed": true,
            "module_stderr": "Shared connection to iDRAC_IP closed.\r\n",
            "module_stdout": "\rcmdstat\r\n\r\tstatus       : 2\r\n\r\tstatus_tag   : COMMAND PROCESSING FAILED\r\n\r\terror        : 252\r\n\r\terror_tag    : COMMAND SYNTAX ERROR\r\n",
            "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
            "rc": 0,
            "warnings": [
                "Platform unknown on host iDRAC_IP is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change the meaning of that path. See https://docs.ansible.com/ansible-core/2.13/reference_appendices/interpreter_discovery.html for more information."
            ]
        }
    },
    "msg": "The following modules failed to execute: ansible.legacy.setup\n"
}

【问题讨论】:

    标签: python ansible


    【解决方案1】:

    主机可能没有使用 Python,但正如您从下面的错误中看到的那样

    该模块使用一个使用端口 443 的 REST API。

    Ansible 不喜欢使用密码,强烈推荐使用 SSH 密钥。 Here is a tutorial to make the keys and place them on ESXI (停止在ESXI部分)。

    Create SSH Keys

    要将 SSH 密钥放在 iDRAC 上(我在 Dell PowerEdge FC430 上使用了此方法),请按照本参考指南第 77 页上的说明进行操作。

    Placing SSH Keys on iDRAC

    对我有用的剧本

    ---
    - hosts: host_file
      gather_facts: False
      collections: dellemc.openmanage
      tasks: 
        - name: Get System Inventory
          dellemc.openmanage.idrac_system_info: 
          idrac_ip: ip 
          idrac_password: pass
          idrac_user: user
          validate_certs: False
        delegate_to: localhost
    

    主机文件包含:

    • 主机IP地址
    • ansible_connection=ssh
    • 远程用户名

    调用 ansible 剧本

    ansible-playbook -vvvv <你的文件>.yml

    如果这不起作用,您应该验证 python 是否升级到 3.8.6,并检查 iDRAC 固件是否升级到 2.82.82.82。

    【讨论】:

      猜你喜欢
      • 2022-07-27
      • 2020-04-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多