dell / dellemc-openmanage-ansible-modules

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

Dell EMC OMSDK library is required for this module #112

Closed grantcurell closed 4 years ago

grantcurell commented 4 years ago

Does not seem to be related to: https://github.com/dell/dellemc-openmanage-ansible-modules/issues/37

I have installed the OpenManage library, but using both Python 3 and Python 2 interpreters with Ansible I receive "Dell EMC OMSDK library is required for this module". Is additional installation required outside of what is listed in the readme?

Error Message

image

Python Version

Python 3.7.6 Note: I also tried it with python 2.7 - same error.

Ansible Version

ansible 2.9.6
  config file = /opt/dell/Dell Ansible Testing/code/ansible.cfg
  configured module search path = ['/home/grant/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.7.6 (default, Jan 30 2020, 10:29:04) [GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]

Inventory

all:
  vars:
    tail_number: 9
    ansible_python_interpreter: /usr/bin/python3
  children:
    nodes:
      children:

    #############################
    # Sensor Settings           #
    #############################

    # Here you will define any variables specific to each sensor host.

        servers:
          hosts:
            r440:
              ansible_host: "r440idrac.lan"
              idrac_ip_address: "192.168.1.63"
              idrac_user: "{{ global_idrac_user }}"
              idrac_password: "{{ global_idrac_pwd }}"

site.yml

[grant@workstation code]$ cat site.yml
---

- name: Restart Servers
  hosts: servers
  connection: local
  gather_facts: False
  roles:
    - power
  tags: restart

role code

---

- name: Configure Server Power Setting - GracefulRestart
  dellemc_change_power_state:
    idrac_ip:   "{{ hostvars[inventory_hostname]['idrac_ip_address'] }}"
    idrac_user: "{{ global_idrac_user }}"
    idrac_password:  "{{ global_idrac_password }}"
    # GracefulRestart is applicable for idrac firmware versions below 3.30.30.30
    change_power: "GracefulRestart"

  tags:
    - graceful-restart

- name: Configure Server Power Setting - ForceRestart
  dellemc_change_power_state:
    idrac_ip:   "{{ hostvars[inventory_hostname]['idrac_ip_address'] }}"
    idrac_user: "{{ global_idrac_user }}"
    idrac_password:  "{{ global_idrac_password }}"
    # ForceRestart is applicable for idrac firmware versions above 3.30.30.30
    reset_type: "ForceRestart"

  tags:
    - force-restart

ansible.cfg

[defaults]
inventory = ./inventory.yml
interpreter_python = /usr/bin/python3
ask_pass = False
[privilege_escalation]
become_ask_pass = False
host_key_checking = False
grantcurell commented 4 years ago

I fixed this error by manually installing the OMSDK module. To the devs - is this by design or did I miss the mark on something? If so, I can provide updated instructions via a pull request. To fix:

  1. git clone https://github.com/dell/omsdk.git
  2. cd omsdk
  3. pip3 install wheel
  4. pip3 install -r requirements-python3x.txt
  5. sh build.sh 1.2 423 # Note: Numbers may change based on current version. See the OMSDK repo for current.
  6. cd dist
  7. pip install omsdk-1.2.423-py2.py3-none-any.whl

After that the error cleared for me.

jagadeeshnv commented 4 years ago

Thanks @grantcurell. Can we close this Issue?

Mixer9 commented 2 years ago

I fixed this issue by adding delegate_to: localhost to my playbook task to update the firmware. I did not have to do any manual install of omsdk, I just used pip3 install omsdk.