#Consistency Group snapshot's expiry time not possible with Ansible ?

1 messages · Page 1 of 1 (latest)

gaunt jetty
#

Hey, I'm making an Ansible playbook to automate consistency group snapshot creation and I'm stuck on setting the expiry-time.

The na_ontap_cg_snapshot module doesn't have an expiry_time parameter, so I'm trying to modify each volume's snapshot after creation. The CLI command works fine manually (snapshot modify -vserver ... -expiry-time "12/20/2025 14:00:00"), but I can't get it working through Ansible.

When I use na_ontap_snapshot with expiry_time, I get error code 1638644 saying PATCH requests on the snapshot endpoint aren't supported on this platform.

I also tried na_ontap_rest_cli with the volume/snapshot command and PATCH verb - it returns success but the expiry date shows as 1/1/1970 ?!, so it's not actually being set.

Anyone know the right way to set snapshot expiry-time with Ansible ?

I tried : -e "netapp_snap_cg_snapshot_expiry_time='2025-12-20T23:59:00+01:00'" and -e "netapp_snap_cg_snapshot_expiry_time='12/20/2025 23:59:00'"

  1. na_ontap_snapshot with expiry_time parameter (ISO 8601 format)
    → Error: POST, DELETE, and PATCH requests on the snapshot session endpoint are not supported on this platform. (code 1638644)
  2. na_ontap_rest_cli with command: "volume/snapshot", verb: PATCH, expiry-time in body
    → Returns success (num_records: 1) but expiry shows as 1/1/1970 01:33:45 (epoch)
  3. na_ontap_rest_cli with command: "volume/snapshot/modify", verb: POST
    → Error: API not found (code 3)
  4. na_ontap_command
    → Error: ZAPI is not supported (code 61253)
#

this is what worked but stcuk at 1970:

    netapp.ontap.na_ontap_rest_cli:
      command: "volume/snapshot"
      verb: PATCH
      params:
        vserver: "{{ netapp_snap_cg_snapshot_vserver_name }}"
        volume: "{{ item }}"
        snapshot: "{{ netapp_snap_cg_snapshot_name }}"
      body:
        expiry_time: "{{ netapp_snap_cg_snapshot_expiry_time }}"
    loop: "{{ netapp_snap_cg_snapshot_volumes }}"
    loop_control:
      label: "Setting {{ netapp_snap_cg_snapshot_name }} for {{ item }}"```