#unable to connect to Ontap filer via ssh using ansible

1 messages · Page 1 of 1 (latest)

high junco
#

I'm unable to connect to Ontap filer via ssh using ansible

ansible -m ping all
SSH password:
10,xx.x.xx | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ",
"unreachable": true

#

ansible 2.9.27

tacit gazelle
high junco
#

This is fixed..by using Vars module instead of module default to login and installing python-requests..

#

Appreciate @tacit gazelle for heping out !!

fair hatch
#

Hi All,
I have same problem. "ansible -m ping filer-ip" doesn't work

Can somebody please post the entire command here? How to use "Vars module"?

tacit gazelle
#

Ansible Ping module does not work with ONTAP.

#

is there any error when using any of the ONTAP Ansible modules? @fair hatch

fair hatch
#

Somehow I was able to use "ansible ping" to ping ONTAP before, if I remember correct.

Anyway, I did several playbooks with Ansible and ONTAPI modules. Now just starting to familiar with REST API. Appreciate it if you could please pin-point what went wrong below.
`---

  • hosts: localhost
    collections:
    • netapp.ontap
      name: ONTAP REST API
      gather_facts: False
      tasks:
    • name: Check for ontap version
      netapp.ontap.na_ontap_rest_info:
      hostname: 1.2.3.4
      username: username
      password: passwd
      https: true
      validate_certs: false
      use_rest: Always
      gather_subset:
      - cluster/software
      query:
      fields: version
      register: result
    • debug: var=result
    • assert: { that: result.status_code==200, quiet: True }
      `

Also, do you have some links/docs on using Ansible with REST API and ONTAP?

fading prawn
#

there is no status_code that is returned

#

' tasks:
- name: Get info
netapp.ontap.na_ontap_rest_info:
hostname: 10.193.78.222
username: admin
password: netapp1!
https: true
use_python_keys: true
fields:
- 'version'
validate_certs: false
use_rest: Always
gather_subset:
- cluster/software
register: results

- name: Print return information from the previous task
  ansible.builtin.debug:
    var: results'
#

will return

TASK [Print return information from the previous task] *********************************************************************************
ok: [localhost] => {
"results": {
"changed": false,
"failed": false,
"ontap_info": {
"cluster_software": {
"_links": {
"self": {
"href": "/api/cluster/software"
}
},
"version": "Metropolitan__9.11.1"
}
}
}
}

PLAY RECAP *****************************************************************************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

fair hatch
#

I used your code, but it didn't work for me. What is " use_python_keys: true" for?
`---

  • hosts: localhost
    collections:
    • netapp.ontap
      name: ONTAP REST API
      gather_facts: False
      tasks:
    • name: Get info
      netapp.ontap.na_ontap_rest_info:
      hostname: 1.2.3.4
      username: admin
      password: netapp1!
      https: true
      use_python_keys: true
      fields:
      - 'version'
      validate_certs: false
      use_rest: Always
      gather_subset:
      - cluster/software
      register: results
    • name: Print return information from the previous task
      ansible.builtin.debug:
      var: results
      `

TASK [Get info] *****************************************************************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (netapp.ontap.na_ontap_rest_info) module: use_python_keys Supported parameters include: cert_filepath, feature_flags, fields, gather_subset, hostname, http_port, https, key_filepath, max_records, ontapi, parameters, password, state, use_rest, username, validate_certs"}