#na_ontap_snapshot_policy not doing what it's supposed to?

1 messages · Page 1 of 1 (latest)

half jewel
#

I have below playbook:

    - name: Update default snapshot policy
      na_ontap_snapshot_policy:
        <<: *login
        state: present
        enabled: True
        name: "default"
        schedule: ['every2hour', 'daily']
        prefix: ['hourly', 'daily']
        count: [11, 7]
        snapmirror_label: ['hourly', 'daily']

This is to replace "hourly" schedule in default policy. But it failed:

TASK [Update default snapshot policy] *********************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error on adding snapshot policy schedule: calling: storage/snapshot-policies/4fa089d1-3c2a-11ee-8a56-d039eaa4a2ed/schedules: got {'message': 'Duplicate prefix \"hourly\". ', 'code': '1638510'}."}

Shouldn't ansible just replace 'hourly' with 'every2hour'? it seems like it's trying to add 'every2hour' first and failed.

Suggestions?

mossy spruce
#

We should be adding the new schedule before adding a new Schedule.

https://github.com/ansible-collections/netapp.ontap/blob/main/plugins/modules/na_ontap_snapshot_policy.py#L671C1-L704C98

Could you enable trace_apis (https://github.com/ansible-collections/netapp.ontap/wiki/Debugging) and send the output to ng-ansibleteam (it should be in a file called) /tmp/ontap_apis.log

This will tell me if a API call is getting skipped or something

GitHub

Ansible collection to support NetApp ONTAP configuration. - ansible-collections/netapp.ontap

GitHub

Ansible collection to support NetApp ONTAP configuration. - ansible-collections/netapp.ontap

half jewel
#

I enabled trace and indeed it is trying to create "every2hour" first and that got "Duplicate prefix" error.
api trace log sent to ng-ansibleteam@netapp.com.

half jewel
#

So the module has error? It should delete the "hourly" schedule before add "every2hour" schedule from "default" snapshot policy.

mossy spruce
#

Thank for the email with out the api outlook give us a little bit to look at and and repuduce this in house