dell / ansible-powerstore

Ansible Modules for Dell PowerStore
GNU General Public License v3.0
34 stars 26 forks source link

Error appears when specify the name of existing volume group #7

Closed ryojsb closed 2 years ago

ryojsb commented 2 years ago

Overview of this Issue

requirements

I would like to make module have idempotency.

detail

vars

- target_powerstore: "Site_A" 
  vg_name: "ansible-test-group1"
- target_powerstore: "Site_A"
  vg_name: "ansible-test-group1"
- target_powerstore: "Site_A"
  vg_name: "ansible-test-group2"

playbook

---
- name: Create volumes group
  hosts: powerstore
  vars_files:
  - credentials/powerstore.yaml
  gather_facts: no  
  tasks:
  - name: Create volume group
    dellemc.powerstore.volumegroup:
      array_ip: "{{ powerstore_array_params[target_powerstore].array_ip }}"
      verifycert: "{{ powerstore_array_params[target_powerstore].verifycert }}"
      user: "{{ powerstore_array_params[target_powerstore].user }}"
      password: "{{ powerstore_array_params[target_powerstore].password }}"
      vg_name: "{{ vg_name }}"
      description: "This volume group is created by ansible"
      state: "present"
    delegate_to: localhost

Error

SSH password: 
PLAY [Create volumes group] ****************************************************
TASK [Create volume group] *****************************************************
fatal: [ansible-test2]: FAILED! => {"changed": false, "error_code": 1, "msg": "Failed to create volume group ansible-test-group1 with error HTTP code: 400, Bad Request [{'messages': [{'code': '0xE0A070010008', 'severity': 'Error', 'message_l10n': 'The operation failed because a volume group with the name \"ansible-test-group1\" already exists.', 'arguments': ['ansible-test-group1']}]}]", "status_code": "400"}
changed: [ansible-test3]
changed: [ansible-test1]
PLAY RECAP *********************************************************************
ansible-test1              : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
ansible-test2              : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   
ansible-test3              : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0