dell / dellemc-openmanage-ansible-modules

Dell OpenManage Ansible Modules
GNU General Public License v3.0
339 stars 163 forks source link

OME not working #271

Closed artemoz2021 closed 3 years ago

artemoz2021 commented 3 years ago

Hello, what i've got: ansible 2.10.8 python 3.8.2 or 2.7.16 Target server: PowerEdge R740xd Target iDRAC firmware: 4.40.00.00

I'm trying to power off server remotely via ansible but the target machine reports with error. I've tryed to use module from collections and master branches, i've also tryed to use different version of python but with no luck.

This is a part of my test playbook:

The first task works correctly (get inventory) but the last isn't

tasks:
  - name: get device info
     ome_device_info:
       hostname:   "{{ server_ip }}"
       username: "{{ user }}"
       password:  "{{ pass }}"
     register: devinfo

  - debug:
      var: devinfo

  - name: power manager on
     ome_powerstate:
       hostname: "{{ server_ip }}"
       username: "{{ user }}"
       password: "{{ pass }}"
       power_state: "off"
       device_service_tag: "{{ device_svc_tag }}"

The erorr message that i've got (the same with python3):

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ValueError: No JSON object could be decoded
failed: [localhost] (item=IP) => changed=false 
  ansible_loop_var: item
  item: IP
  module_stderr: |-
    Traceback (most recent call last):
      File "<stdin>", line 102, in <module>
      File "<stdin>", line 94, in _ansiballz_main
      File "<stdin>", line 40, in invoke_module
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 188, in run_module
        fname, loader, pkg_name)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 82, in _run_module_code
        mod_name, mod_fname, mod_loader, pkg_name)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
        exec code in run_globals
      File "/var/folders/qc/nl8xrkcs6jx512jytxm_gl6c0000gp/T/ansible_ome_powerstate_payload_4aFVTN/ansible_ome_powerstate_payload.zip/ansible/modules/dellemc/ome_powerstate.py", line 289, in <module>
      File "/var/folders/qc/nl8xrkcs6jx512jytxm_gl6c0000gp/T/ansible_ome_powerstate_payload_4aFVTN/ansible_ome_powerstate_payload.zip/ansible/modules/dellemc/ome_powerstate.py", line 281, in main
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 291, in load
        **kw)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 339, in loads
        return _default_decoder.decode(s)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 364, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 382, in raw_decode
        raise ValueError("No JSON object could be decoded")
    ValueError: No JSON object could be decoded
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1

Please help, i don't understand what the purpose of this error.

anupamaloke commented 3 years ago

@artemoz2021, ome_device_info and ome_powerstate are OpenManage Enterprise (OME) Ansible Modules. These modules work with OME only. If you want to run a workflow on iDRAC directly, then you must use modules that are prefixed with idrac_ or dellemc_idrac_ or redfish_. For e.g. the iDRAC modules for getting system inventory and performing powerstate operations are idrac_system_info and redfish_powerstate respectively.

Could you please confirm whether you are running the modules with OME or iDRACs?

artemoz2021 commented 3 years ago

Hello. It worked, Thanks for help!