hpe-storage / nimble-ansible-modules

HPE Nimble Storage Ansible Modules
https://hpe-storage.github.io/nimble-ansible-modules
GNU General Public License v3.0
2 stars 7 forks source link

modified ACR module to support create and delete for snapshot,pe, and volume. #5

Closed ar-india closed 4 years ago

ar-india commented 4 years ago

for a given ansible task like below

# if state is create, then create acl for given volume, fails if it exist or cannot create
# if state is present, then create acl if not present, else success
- name: Create ACR for volume
  hpe_nimble_access_control_record:
    hostname: "{{ hostname }}"
    username: "{{ username }}"
    password: "{{ password }}"
    volume: "{{ansible_default_ipv4['address']}}-{{ volume }}"
    #initiator_group: "{{ansible_default_ipv4['address']}}-{{ initiator_group }}"
    # chap_user: "{{ chap_user }}"
    state: "{{ state | default('present') }}"

Output will be :

[root@centos80x64tmp ansible]# ansible-playbook playbook/hpe_nimble_access_control_records_playbook.yml -i hosts --tags "create_acr"

PLAY [localhost] ****

TASK [Create ACR for volume] **** fatal: [localhost]: FAILED! => {"changed": false, "msg": "Access control record creation failed. Please provide one of them: initiator_group or snapshot or protocol endpoint.", "return_status": false}

PLAY RECAP ** localhost : ok=2 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0


So , for creating acr , initiator group is always a mandatory param and one among volume, snapshot, pe or chap user is also required.

ex:

Output:

[root@centos80x64tmp ansible]# ansible-playbook playbook/hpe_nimble_access_control_records_playbook.yml -i hosts --tags "create_acr" -v Using /etc/ansible/ansible.cfg as config file

PLAY [localhost] ****

TASK [Create ACR for volume] **** changed: [localhost] => {"changed": true, "msg": "Successfully created access control record for initiator group '10.18.180.239-ig-ansiblecentos1' associated with volume '10.18.180.239-ansible-vol1'.", "return_status": true}

PLAY RECAP ** localhost : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

[root@centos80x64tmp ansible]#