ONTAP Rest API Discussions
ONTAP Rest API Discussions
Hi -- I am wondering how to convert this functioning Ansible snippet into the REST version? TIA!
- name: run vserver cifs options modify is-netbios-over-tcp-enabled false
na_ontap_command:
command:
- set adv;
- vserver cifs options modify -vserver {{ item.name }} -is-netbios-over-tcp-enabled false
return_dict: yes
<<: *login
with_items:
- "{{ svm }}"
register: command_result
tags: [command,cifs-security]
Solved! See The Solution
This seems to work ... it will always show as 'changed' since there's no idempotence but that shouldn't be a problem. The module handles the advanced privilege setting.
I assume you meant this module (na_ontap_rest_cli) and not a straight REST CLI call you'd make from code. If you did mean from code then you'd use the /private/cli API.
gather_facts: no
collections:
- netapp.ontap
module_defaults:
group/netapp.ontap.netapp_ontap:
hostname: xxx.xxx.xxx.xxx
username: admin
password: Netapp1!
https: true
validate_certs: false
vars:
svm:
- { name: "svmCifsData" }
tasks:
- name: REST CLI
netapp.ontap.na_ontap_rest_cli:
command: 'vserver/cifs/options'
verb: 'PATCH'
params:
vserver: "{{ item.name }}"
body: {'is-netbios-over-tcp-enabled': false}
with_items: "{{ svm }}"
loop_control:
label: "{{ item.name }}"
register: result
tags: [command,cifs-security]
- debug:
var: result
This seems to work ... it will always show as 'changed' since there's no idempotence but that shouldn't be a problem. The module handles the advanced privilege setting.
I assume you meant this module (na_ontap_rest_cli) and not a straight REST CLI call you'd make from code. If you did mean from code then you'd use the /private/cli API.
gather_facts: no
collections:
- netapp.ontap
module_defaults:
group/netapp.ontap.netapp_ontap:
hostname: xxx.xxx.xxx.xxx
username: admin
password: Netapp1!
https: true
validate_certs: false
vars:
svm:
- { name: "svmCifsData" }
tasks:
- name: REST CLI
netapp.ontap.na_ontap_rest_cli:
command: 'vserver/cifs/options'
verb: 'PATCH'
params:
vserver: "{{ item.name }}"
body: {'is-netbios-over-tcp-enabled': false}
with_items: "{{ svm }}"
loop_control:
label: "{{ item.name }}"
register: result
tags: [command,cifs-security]
- debug:
var: result
Thanks @JohnChampion ! Good to know that the module will auto-handle the privilege issue.