HI
I manage 11 clusters , all at ontap 9.12, and we use ansible for some of our activities.
I am need of listing snapshots on our clusters, I have yaml scripts that create and delete snapshots for various activies including cloning, but I do not see an ansible command for listing (snapshot show). I would prefer not having to make a cli command through a separate script through ansible.builtin.shell.
also, I am looking for a way to make the output human readable since i will be getting our DBAs to read the results during their patching and they want to see the output properly displayed
thanks
#view snapshots
1 messages · Page 1 of 1 (latest)
Would the na_ontap_rest_info module with subset storage/volumes/snapshots get you what you need?
i have tried but i keep getting paramiter issues when i try to run a script.... I cannot find an example of how to set up the command... on the ansible website they only show a few examples of other gather_subset but not for snapshot... sorry, it takes a while to respond as iwe do not allow discord on our netwrok, so i need to go back and forth
do you have an example of running the gather_subnet for show snapshot
This is my script (it will be at the end of a larger script)
-
name: Script_EBS_snapshot_list
vars:
snapshot_name_prefix: "EBS_SNAP_"
snapshot_name: "{{ snapshot_name_prefix }}{{ ansible_date_time.date }}_{{ ansible_date_time.time }}"hosts: "local"
tasks:
- name: Gather Volume move information for a specific volume
netapp.ontap.na_ontap_info:
hostname: "{{ item.cluster }}"
username: "{{ admin_user }}"
password: "{{ admin_password }}"
gather_subset: snapshot_info
snapshot_info:
volume: ""
vserver: ""
loop:- { cluster: 'MyCluster01' }
- { cluster: 'MyCluster02' }
- name: Gather Volume move information for a specific volume
Try na_ontap_rest_info instead
thank you, i will give this a try
There's an example for snapshots - difference is it requires an owning resource
- name: Get Snapshot info (owning_resource example)
netapp.ontap.na_ontap_rest_info:
hostname: "1.2.3.4"
username: "testuser"
password: "test-password"
https: true
fields:
- '*'
validate_certs: false
use_rest: Always
gather_subset:
- storage/volumes/snapshots
owning_resource:
volume_name: volume_name
svm_name: svm_name
Don't copy and paste this - formatting is off - but you can do 'ansible-doc netapp.ontap.na_ontap_rest_info'
You could try saving the json and importing into Excel possibly.
I got it to run without error, though did not get any output... I guess that is the next step to figure out