HI Vladimir,

Thank you again.

I think that is what I am looking for but it is when running with verbosity
( -vvvv).

Could you please go through below mentioned -vvv output where i can see
required output under MSG ( highlighted in blue):

Can we get output of only MSG instead of listing all other output so that i
can seethe required output?


TASK [run ontap rest cli command for vol move resister variabele]
************************************************************
***************************************************************
task path: /home/user1/facts/netapp_volume_move.yml:38
< removed some data >
    "attempts": 1,
    "changed": true,
    "invocation": {
        "module_args": {
            "body": {},
            "cert_filepath": null,
            "command": "volume/move?fields=percent-complete,state",
            "feature_flags": {},
            "hostname": "Cluster1",
            "http_port": null,
            "https": true,
            "key_filepath": null,
            "ontapi": null,
            "params": {
                "volume": "*",
                "vserver": "*"
            },
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "use_rest": "Always",
            "username": "user1",
            "validate_certs": false,
            "verb": "GET"
        }
    },
    "retries": 36
}

*MSG:*

{'records': [{'vserver': 'svm1', 'volume': 'svm1_mp_v3', 'state': 'done',
'percent_complete': 100}, {'vserver': 'svm2', 'volume':
'user1_test_clone2', 'state': 'done', 'percent_complete': 100}, {'vserver':
'svm2', 'volume': 'user1_test_clone3', 'state': 'healthy',
'percent_complete': 98}], 'num_records': 3}
< removed some data >
FAILED - RETRYING: run ontap rest cli command for vol move resister
variabele (34 retries left).Result was: {
    "attempts": 2,
    "changed": true,
    "invocation": {
        "module_args": {
            "body": {},
            "cert_filepath": null,
            "command": "volume/move?fields=percent-complete,state",
            "feature_flags": {},
            "hostname": "Cluster1",
            "http_port": null,
            "https": true,
            "key_filepath": null,
            "ontapi": null,
            "params": {
                "volume": "*",
                "vserver": "*"
            },
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "use_rest": "Always",
            "username": "user1",
            "validate_certs": false,
            "verb": "GET"
        }
    },
    "retries": 36
}

*MSG:*

{'records': [{'vserver': 'svm1', 'volume': 'svm1_mp_v3', 'state': 'done',
'percent_complete': 100}, {'vserver': 'svm2', 'volume':
'user1_test_clone2', 'state': 'done', 'percent_complete': 100}, {'vserver':
'svm2', 'volume': 'user1_test_clone3', 'state': 'healthy',
'percent_complete': 98}], 'num_records': 3}
< removed some data >
FAILED - RETRYING: run ontap rest cli command for vol move resister
variabele (33 retries left).Result was: {
    "attempts": 3,
    "changed": true,
    "invocation": {
        "module_args": {
            "body": {},
            "cert_filepath": null,
            "command": "volume/move?fields=percent-complete,state",
            "feature_flags": {},
            "hostname": "Cluster1",
            "http_port": null,
            "https": true,
            "key_filepath": null,
            "ontapi": null,
            "params": {
                "volume": "*",
                "vserver": "*"
            },
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "use_rest": "Always",
            "username": "user1",
            "validate_certs": false,
            "verb": "GET"
        }
    },
    "retries": 36
}

*MSG:*

{'records': [{'vserver': 'svm1', 'volume': 'svm1_mp_v3', 'state': 'done',
'percent_complete': 100}, {'vserver': 'svm2', 'volume':
'user1_test_clone2', 'state': 'done', 'percent_complete': 100}, {'vserver':
'svm2', 'volume': 'user1_test_clone3', 'state': 'healthy',
'percent_complete': 98}], 'num_records': 3}
< removed some data >
FAILED - RETRYING: run ontap rest cli command for vol move resister
variabele (32 retries left).Result was: {
    "attempts": 4,
    "changed": true,
    "invocation": {
        "module_args": {
            "body": {},
            "cert_filepath": null,
            "command": "volume/move?fields=percent-complete,state",
            "feature_flags": {},
            "hostname": "Cluster1",
            "http_port": null,
            "https": true,
            "key_filepath": null,
            "ontapi": null,
            "params": {
                "volume": "*",
                "vserver": "*"
            },
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "use_rest": "Always",
            "username": "user1",
            "validate_certs": false,
            "verb": "GET"
        }
    },
    "retries": 36
}

*MSG:*

{'records': [{'vserver': 'svm1', 'volume': 'svm1_mp_v3', 'state': 'done',
'percent_complete': 100}, {'vserver': 'svm2', 'volume':
'user1_test_clone2', 'state': 'done', 'percent_complete': 100}, {'vserver':
'svm2', 'volume': 'user1_test_clone3', 'state': 'healthy',
'percent_complete': 98}], 'num_records': 3}
< removed some data >
changed: [Cluster1] => {
    "attempts": 5,
    "changed": true,
    "invocation": {
        "module_args": {
            "body": {},
            "cert_filepath": null,
            "command": "volume/move?fields=percent-complete,state",
            "feature_flags": {},
            "hostname": "Cluster1",
            "http_port": null,
            "https": true,
            "key_filepath": null,
            "ontapi": null,
            "params": {
                "volume": "*",
                "vserver": "*"
            },
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "use_rest": "Always",
            "username": "user1",
            "validate_certs": false,
            "verb": "GET"
        }
    }
}

*MSG:*

{'records': [{'vserver': 'svm1', 'volume': 'svm1_mp_v3', 'state': 'done',
'percent_complete': 100}, {'vserver': 'svm2', 'volume':
'user1_test_clone2', 'state': 'done', 'percent_complete': 100}, {'vserver':
'svm2', 'volume': 'user1_test_clone3', 'state': 'done', 'percent_complete':
100}], 'num_records': 3}
Read vars_file '/home/user1/facts/cred_file_Privileged_account.yml'




On Wed, Jun 21, 2023 at 10:39 PM Vladimir Botka <[email protected]> wrote:

> 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/CANGEjuWoL%2BE5HSGafp4LBkAWscPZv8jM95sRjUiH87O1Mbew_w%40mail.gmail.com.

Reply via email to