#snaplock enablement/functionality which ansible module ??

1 messages · Page 1 of 1 (latest)

strange haven
#

Hi All, Can someone please help me the exact ansible module to use for enabling nfs vol snaplock enable.

I am currently using below module and parameters :

  • name: Set volume snaplock
    na_ontap_volume_snaplock:
    vserver: svm
    name: ansibleVolume
    default_retention_period: "5 days"
    minimum_retention_period: "0 years"
    maximum_retention_period: "10 days"
    is_volume_append_mode_enabled: False
    hostname: "{{ netapp_hostname }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"

and I am getting this error.

TASK [set snaplock] *******************************************************************************************************************************************************************
ERROR! couldn't resolve module/action 'na_ontap_volume_snaplock'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/home/xyz/ansible-netapp/roles/T9_worm_snaplock/tasks/main.yml': line 1, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  • name: set vol snaplock
    ^ here
strange haven
#

Ok.. Thanks Rene. so this one I used.now I get this error, you have any suggestions/hint please! TASK [T9_worm_snaplock : volume create with snaplock set.] ****************************************************************************************************************************
fatal: [xyz.com]: FAILED! => {"changed": false, "msg": "Error: snaplock options are not supported for non_snaplock volume, found: {'retention': {'default': 'PT1M'}}."}

PLAY RECAP ****************************************************************************************************************************************************************************
xyz.com : ok=57 changed=3 unreachable=0 failed=1 skipped=3 rescued=0 ignored=0 The module I am using is this below with given parameters : - name: volume create with snaplock set.
netapp.ontap.na_ontap_volume:
state: present
name: "{{ finalvolname }}"
vserver: "{{ svm }}"
hostname: "{{ host_name }}"
username: "{{ username }}"
password: "{{ password }}"
space_guarantee: none
policy: default
type: rw
snaplock:
type: enterprise
retention:
default: "{{ 60 | netapp.ontap.iso8601_duration_from_seconds }}"

obtuse wraith
#

You cannot convert an existing flexvol to a snaplock volume. You have to create a new volume with the snaplock options.

And check if:

  • snaplock licence is available
  • snaplock clock is initialized
  • ONTAP 9.10.1 +
strange haven
#

Hi @obtuse wraith @jade atlas , Thanks!!

I used this Module with parameters and it worked, But, Not able to figure out how can I choose and set/apply minimum,maximum retention period and auto-commit period values of my choice. since using this default retention as mentioned in module sets some different values.

  • name: create volume with snaplock set
    netapp.ontap.na_ontap_volume:
    hostname: "{{ host_name }}"
    vserver: "{{ svm }}"
    https: true
    validate_certs: false
    username: "{{ username }}"
    password: "{{ password }}"
    state: present
    name: "{{ finalvolname }}"
    aggregate_name: "{{ final_selected_aggr_t9 }}"
    size: "{{ required_size | int }}"
    size_unit: gb
    policy: default
    junction_path: "/{{ finalvolname }}"
    volume_security_style: unix
    space_guarantee: none
    type: RW
    snapshot_policy: none
    percent_snapshot_space: 0
    snaplock:
    type: enterprise
    retention:
    default: "{{ 60 | netapp.ontap.iso8601_duration_from_seconds }}"
    ~
    ~

I need to modify the minimum,maximum retention period and auto-commit period values. Would you please help with that.

tawny sky
#

What value is getting set when you run that

strange haven
#

Hi Chris, PFA values getting set with this as default.
I need to set specific values for retention:
minimum_retention_period -- 2 yrs.
maximum_retention_period -- 7yrs.
auto_commit period --- 12 hours.