#Enforce NIS group database rebuild frequency using rest_cli

1 messages · Page 1 of 1 (latest)

primal plank
#

Hello,

I want to enforce the following action using REST CLI:
vserver services name-service nis-domain group-database config modify -vserver MY_SVM-state enabled -build-interval 1h

I tried with below playbook :

- name: SVM | create | set NIS group-database build-interval
  netapp.ontap.na_ontap_rest_cli:
    hostname: "{{ nas_hostname }}"
    username: "{{ nas_username }}"
    password: "{{ nas_password }}"
    https: true
    validate_certs: false
    command: 'vserver/services/name-service/nis-domain/group'
    verb: 'PATCH'
    params: {
      'vserver': 'vs_{{ target }}',
    }
    body: {
      'state': 'enabled',
      'build-interval': '1h'
    }

But this fails.

Could someone provide me an example of a playbook to enforce the NIS group rebuild frequency ?

viral fern
#

can you share the error message it fails with?

primal plank
#

Collection output ....

#

TASK [ds-role-nas_CRUD : SVM | create | set NIS group-database build-interval] **************************************************************************************************************************************************************
Wednesday 03 April 2024 16:13:05 +0200 (0:00:00.483) 0:00:37.380 *******
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error: {'message': 'Unexpected argument "state".', 'code': '262179', 'target': 'state'}"}

#

I'am unsure about :

#
  • command :
#
  • params
#
  • body
#

The mapping between CLI and rest_cli is not obvious

viral fern
#

did you try dropping the 'state': 'enabled' line?

primal plank
#

Without 'state' field, I get :

#

TASK [ds-role-nas_CRUD : SVM | create | set NIS group-database build-interval] **************************************************************************************************************************************************************
Wednesday 03 April 2024 17:48:03 +0200 (0:00:00.503) 0:00:38.701 *******
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error: {'message': 'Unexpected argument "build-interval".', 'code': '262179', 'target': 'build-interval'}"}

#

Is there some documentation to map CLI cmmands to REST_CLI module ?

#

I'am aware about the generic guideline to transition to REST for REST_CLI. But it does not apply to all existing CLI commands.

hexed lotus
#

Your command path is incomplete. Besides there is no need for this complicated params and body formatting. I tested the following successfully:

- name: SVM | create | set NIS group-database build-interval netapp.ontap.na_ontap_rest_cli: command: vserver/services/name-service/nis-domain/group-database/config verb: PATCH params: vserver: "{{ target }}" body: state: enabled build-interval: 1h

primal plank
#

Thx a lot.

#

It works!