0

I'm trying to run a command through na_ontap_command ansible module on NetApp 8.3 ONTAP:

- na_ontap_command:
    command: ['version']
    hostname: "{{ corp2 }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"
    register: snaplist

- name: print the op
    debug:
    var: snaplist  

And I'm getting below message when I print the output. I'm expecting a version number.

"msg": [
    {
        "snaplist": [
            "<results xmlns=\"http://www.netapp.com/filer/admin\" status=\"passed\"><cli-output/><cli-result-value>0</cli-result-value></results>"
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
asr369
  • 1
  • Try adding `return_dict: yes` to the options. (If using 2.9) – Jack May 25 '20 at 11:59
  • There definitely should be more output. Your debug output indicates you're using `msg` instead of `var`. Your code says you're using `var`, but your output says otherwise. – Jack May 25 '20 at 12:10
  • unfortunately, we are on 8.3 ONTAP, and had to use 2.6 to get working. However, the output is same if i use msg or var. and the task says changed but with no o/p. – asr369 May 26 '20 at 06:53
  • That does not make sense. I'm looking at the output you posted, and the ouput just ENDS after `"`. There has to be more, at least to close the open brackets. – Jack May 26 '20 at 13:27
  • my bad i missed the quotes part, however, i got it fixed by adding console access to user. But, is there an option to parse the o/p, basically my intention is to get the list of snapshots for a volume and delete. I can't upgrade ansible version to 2.9 because of ontap 8.3 version compatibility. It gives the o/p of version as below, but lot of unwanted info. "msg": "\n\nNetApp Release 8.3.1P1: Fri Oct 02 11:25:22 UTC 2015\n\n1" – asr369 May 26 '20 at 18:25
  • would you mind adding these details to your question? Also, if you found a solution, is good to add it as an answer, rather than comment, although is yours. – azbarcea May 31 '20 at 13:02

0 Answers0