NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform. You will still be able to view content, but posting and replying will be temporarily disabled.
We're excited to launch our new Community experience on July 30 and more information will follow soon.
Stay connected during the transition - Join our Discord community today.

ONTAP Rest API Discussions

set adv with na_ontap_rest_cli

SCL
2,898 Views

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]
1 ACCEPTED SOLUTION

JohnChampion
2,833 Views

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

 

 

View solution in original post

2 REPLIES 2

JohnChampion
2,834 Views

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

 

 

SCL
2,805 Views

Thanks @JohnChampion ! Good to know that the module will auto-handle the privilege issue.

Public