Hello all,
is it possible via Ansible to enable the Snapdiff RPC server for a SVM?
https://docs.netapp.com/us-en/ontap-cli-9121//vserver-snapdiff-rpc-server-on.html
#SnapDiff RPC Server
1 messages · Page 1 of 1 (latest)
You can do almost anything via Ansible with the two generic modules:
na_ontap_restit - https://docs.ansible.com/ansible/devel/collections/netapp/ontap/na_ontap_restit_module.html
na_ontap_rest_cli - https://docs.ansible.com/ansible/devel/collections/netapp/ontap/na_ontap_rest_cli_module.html
I would prefer na_ontap_restit when there is a REST endpoint available. You can check that in the API reference: https://docs.netapp.com/us-en/ontap-automation/reference/api_reference.html
na_ontap_rest_cli is the last resort, it basically executes commands like on the cli.
Thanks for the info.
Unfortunately, a RestAPI endpoint does not seem to exist.
Until this changes, I would then do this via the Rest CLI way, but don't yet understand where I can find the info on what the appropriate body for the POST needs to look like.
So with which parameters do I have to call e.g. the Ansible Rest CLI module to start the SnapdiffRPC server in my specific case?
the following does not work:
netapp.ontap.na_ontap_rest_cli:
command: 'vserver/snapdiff-rpc-server'
verb: 'POST'
params: {'vserver': 'svm01'}
body: {'state': 'on'}
It maybe PATCH instead of POST because no object is being created. Otherwise looks ok, but you can omit the json surroundings for params and body. My untested guess:
netapp.ontap.na_ontap_rest_cli: command: vserver/snapdiff-rpc-server verb: PATCH params: vserver: svm01 body: state: on
Thanks for the feedback.
I have tested your code and get a changed on every run. I understand that as well, since it is a CLI command and therefore not idempotent of course.
However, the RPC server is still not started on ONTAP side.
changed: [localhost] => {
"changed": true,
"invocation": {
"module_args": {
"body": {
"state": true
},
"cert_filepath": null,
"command": "vserver/snapdiff-rpc-server",
"feature_flags": null,
"force_ontap_version": null,
"hostname": "<HOSTNAME>",
"http_port": null,
"https": true,
"key_filepath": null,
"ontapi": null,
"params": {
"vserver": "svm01"
},
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"use_rest": "always",
"username": "<USERNAME>",
"validate_certs": false,
"verb": "PATCH"
}
},
"msg": {
"num_records": 0
}
}
Then my guess must have been wrong. 🫣 Did you also try with POST?
If you open up the rest api. https://library.netapp.com/ecmdocs/ECMLP2885799/html/ The very last gray sections at the top Using the private CLI should have that info
Tested working version:
netapp.ontap.na_ontap_rest_cli: command: vserver/snapdiff-rpc-server verb: POST body: vserver: svm01 state: 'on'
Good morning and thank you very much. The version works.
Can you tell me how to find out what goes into the body of the CLI module and what goes into the parameters? I have not really discovered this in the documentation.
And again many thanks