the ACR module code prior to this only allowed a user to modify acr for a given volume. but going by the rest api spec. acr can also be created/deleted for snapshot, pe. Hence have revamped the acr logic to make it more generic and support creation/deletion for all the different type of objects.
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') }}"
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}
[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}
for a given ansible task like below
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]#