Dell EMC Unity/Unisphere with Ansible

250 views
Skip to first unread message

Tanisha Mishra

unread,
Sep 21, 2019, 11:23:13 PM9/21/19
to Ansible Project
Using the python module https://github.com/jialehuo/ansible-dellemc-unity/blob/master/library/dellemc_unity.py , below have designed the playbook but am facing Request body errors.

PLAYBOOK:
---
- hosts: localhost

  vars_prompt:
    - name: pool_id
      prompt: "pool_1 : Database Pool\npool_2 : VMWare Pool\npool_3 : ATKHUNITY500-C5_NLSAS_POOL0\npool_4 : NAS-Mixed\nSelect the pool id"
      private: no
    - name: lun_name
      prompt: "Enter LUN Name"
      private: no
    - name: lun_size
      prompt: "Enter LUN Size(GB)"
      private: no
    - name: user
      prompt: "Enter Username"
      private: no
    - name: password
      prompt: "Enter Password"
      private: no

  tasks:
    - name: Updates
      dellemc_unity:
        unity_hostname: "165.114.74.40"
        unity_username: "{{ user }}"
        unity_password: "{{ password }}"
        unity_updates:
          - { resource_type: storageResource, fields: 'name:{{ lun_name }}, lunParameters:{pool: {id: "{{ pool_id }}"}, size: "{{ lun_size }}", isThinEnabled:"true", isDataReductionEnabled:"false"}', action: 'createLun' }
      register: result

    - debug:
        var: result
------------------------------------------------------------------------------------------------------------------------------------------------------------

ERROR:
fatal: [localhost]: FAILED! => {
    "changed": false,
    "failed": true,
    "invocation": {
        "module_args": {
            "unity_hostname": "165.114.74.40",
            "unity_license_path": null,
            "unity_password": "xxxxxxxxxxxx",
            "unity_password_updates": null,
            "unity_queries": null,
            "unity_updates": [
                {
                    "action": "createLun",
                    "fields": "name:test_LUN, lunParameters:{pool: {id: \"pool_1\"}, size: \"1\", isThinEnabled:\"true\", isDataReductionEnabled:\"false\"}",
                    "resource_type": "storageResource"
                }
            ],
            "unity_username": "admin"
        }
    },
    "msg": {
        "args": {
            "fields": "name:test_LUN, lunParameters:{pool: {id: \"pool_1\"}, size: \"1\", isThinEnabled:\"true\", isDataReductionEnabled:\"false\"}"
        },
        "error": {
            "created": "2019-09-22T03:20:27.622Z",
            "errorCode": 131149877,
            "httpStatusCode": 422,
            "messages": [
                {
                    "en-US": "Request body is not correct. There may be duplicate parameters, wrong parameter name. Please refer to API documentation page and ensure the body is correct. (Error Code:0x7d13035)"
                }
            ]
        },
    },
    "unity_query_results": [],
    "unity_update_results": []
}



I have highlight the message. Please help out if someone has faced this error sometime or other.

Thank you :)

Vladimir Botka

unread,
Sep 22, 2019, 2:25:38 AM9/22/19
to Tanisha Mishra, ansible...@googlegroups.com
On Sat, 21 Sep 2019 20:23:13 -0700 (PDT)
Tanisha Mishra <tanisha.mi...@gmail.com> wrote:

> Using the python module
> https://github.com/jialehuo/ansible-dellemc-unity/blob/master/library/dellemc_unity.py ,
> [...]
> - name: Updates
> dellemc_unity:
> unity_hostname: "165.114.74.40"
> unity_username: "{{ user }}"
> unity_password: "{{ password }}"
> unity_updates:
> - { resource_type: storageResource, fields: 'name:{{ lun_name }},
> lunParameters:{pool: {id: "{{ pool_id }}"}, size: "{{ lun_size }}",
> isThinEnabled:"true", isDataReductionEnabled:"false"}', action: 'createLun'
> }
> [...]
> * "en-US": "Request body is not correct. There may be
> duplicate parameters, wrong parameter name. Please refer to API
> documentation page and ensure the body is correct. (Error Code:0x7d13035)"*

The parameter "unity_updates" seems to be wrong. Make sure the parenthesis,
quotation and other items are correct. Try to create the list (if
"unity_updates" is really a list) of dictionaries first and take a look at
the debug whether this is what you want. For example, or rather as a
demonstration of the proposal (I have no idea of the module's details)

- set_fact:
unity_updates: "{{ unity_updates|default([]) +
[{resource_type: storageResource,
fields: 'name:{{ lun_name }},
lunParameters: {pool: {id: "{{ pool_id }}"}},
size: "{{ lun_size }}",
isThinEnabled:"true",
isDataReductionEnabled:"false"}',
action: 'createLun'}] }}"
- debug:
var: unity_updates

Cheers,

-vlado

Vijay Ravindran

unread,
Jan 4, 2020, 3:43:10 AM1/4/20
to Ansible Project
HI Team

I am having a tough time on changing the mgmt ip address via URI module and even properly having login info, logout and updating headers.
Still I get "HTTP Error 401"

The URL which I update is via POST
"https://<unity_ip>/api/instances/mgmtInterfaces/mgmt_ipv4/action/modify"

request your thoughts

thanks

regds
Vj
Reply all
Reply to author
Forward
0 new messages