On Wed, 21 Jun 2023 19:34:21 +0000
Aharonu <[email protected]> wrote:

>       - name: run ontap rest cli command to check volume move status
>         netapp.ontap.na_ontap_rest_cli:
>           <<: *login
>           hostname: "{{ inventory_hostname }}"
>           command: 'volume/move?fields=percent-complete,state'
>           params:
>             volume: '*'
>             vserver: '*'
>           verb: 'GET'
>         register: variable_data
> ...
>
> TASK [debug] ****************
> ok: [cluster1] => {
>     "variable_data": {
>         "changed": true,
>         "failed": false,
>         "msg": {
>             "num_records": 3,
>             "records": [
>                 {
>                     "percent_complete": 30,
>                     "state": "done",
>                     "volume": "vol1",
>                     "vserver": "svm1"
>                 },
>                 {
>                     "percent_complete": 98,
>                     "state": "healthy",
>                     "volume": "vol2",
>                     "vserver": "svm1"
>                 },
>                 {
>                     "percent_complete": 50,
>                     "state": "done",
>                     "volume": "vol1",
>                     "vserver": "svm2"
>                 }
>             ]
>         }
>     }
> }

Try the tasks below. Register the *variable_data* in the first task
and use it in the starting *until* condition of the second task. You
want to repeat it every 1 minute. Set *delay* 60 seconds and *retry*
for example 60 times (1 hour)

      - netapp.ontap.na_ontap_rest_cli:
          <<: *login
          hostname: "{{ inventory_hostname }}"
          command: 'volume/move?fields=percent-complete,state'
          params:
            volume: '*'
            vserver: '*'
          verb: 'GET'
        register: variable_data

      - netapp.ontap.na_ontap_rest_cli:
          <<: *login
          hostname: "{{ inventory_hostname }}"
          command: 'volume/move?fields=percent-complete,state'
          params:
            volume: '*'
            vserver: '*'
          verb: 'GET'
        register: variable_data
        until: variable_data.msg.records|
               selectattr('percent_complete', 'ne', 100)|
               list|length == 0
        delay: 60
        retry: 60

This way you are actually monitoring the volumes. But, Ansible can't
provide you with any intermediate data. The task is running on the
remote host and you'll see the results once the task completes and
returns the results to the controller.

Try to configure NetApp system monitors if you want to see any
progress . See
https://docs.netapp.com/us-en/cloudinsights/task_system_monitors.html#monitor-descriptions


-- 
Vladimir Botka

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20230622003939.574e99a0%40gmail.com.

Attachment: pgpj4bs4mzFPZ.pgp
Description: OpenPGP digital signature

Reply via email to