Software Development Kit (SDK) and API Discussions

Ansible - Ontap not reachable when running the playbooks

AndresPastrana
2,479 Views

Hello all, 

  

Have setup new ansible server to work with netapp api playbooks.
Able to reach the netapp normally from the server via ssh but when i am running the playbooks the ontap is not reachable
Its going till login prompt then its unreachable.

 

Error:
[root@fieslpstmgt01 ansible]# ansible-playbook netapptest.yaml
[WARNING]: Ansible is being run in a world writable directory (/etc/ansible), ignoring it as an ansible.cfg source. For more information see
https://docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-dir

 

PLAY [Ontap REST API] **************************************************************************************************************************************************

 

TASK [Gathering Facts] *************************************************************************************************************************************************
fatal: [10.47.17.178]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ############################################################################\n WARNING - COMPUTER MISUSE ACT 1990\n You will commit a criminal offence if you act outside your\n authority in relation to this Device.\n The penalty is a fine, imprisonment, or both.\n If you are acting outside your authority, do\n not proceed any further. If you are acting within your\n authority, please note that your use of this system may be\n monitored for operational or business reasons.\n This is an assest of TSC Enterprise Cloud Product\n############################################################################", "unreachable": true}

 

PLAY RECAP *************************************************************************************************************************************************************
10.47.17.178 : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0
this is my banner set on ontap so its reading it
but not able to connect to ontap after that.

normal ssh login from same system:

[ansibleadm@fieslpstmgt01 ~]$ ssh 10.47.17.178
############################################################################
WARNING - COMPUTER MISUSE ACT 1990
You will commit a criminal offence if you act outside your
authority in relation to this Device.
The penalty is a fine, imprisonment, or both.
If you are acting outside your authority, do
not proceed any further. If you are acting within your
authority, please note that your use of this system may be
monitored for operational or business reasons.
This is an assest of TSC Enterprise Cloud Product
############################################################################


ansible version ansible 2.9.21
Python 2.7.18

 

Any help is appreciated.

6 REPLIES 6

RossC
2,364 Views

Hi @AndresPastrana 

 

Whilst I am not sure how to address your specific issue I wanted to let you know we have a Community Discord and there is an #Ansible channel that is actively used by customers, partners and Ansible savvy NetApp volunteers. So you may want to head over to there to check it out and ask your question there.

 

More info about our Discord is here, https://community.netapp.com/t5/Digital-Support/The-Official-NetApp-Discord/ba-p/170915/ 

 

LaurentN
2,344 Views

Ansible expects a Linux OS when using plain SSH.  This is not the case for ONTAP.  We are providing a set of Ansible modules that are using ONTAP REST APIs or ZAPIs for older systems.  These APIs are running over HTTPS.  The collection is netapp.ontap and is available through Ansible Galaxy. 

obassett
2,342 Views

You don't set the host in the inventory as the ONTAP system, instead it needs to be a linux box (typically the host you run ansible from) and you specify the connection details for ONTAP in the playbook. There are some samples in this github repository: https://github.com/NetApp-Automation/ansible/tree/main/ontap.

or as Ross has said you can jump on the community discord and get more help there.

Sharing the playbook may help.

nitinraj
2,315 Views

hello obasset,

 

below is the playbook :-

 

[root@fieslpstmgt01 ansible]# cat netapptest.yaml
-
name: Ontap REST API
hosts: 10.47.17.178
gather_facts: true
collections:
- netapp.ontap
vars:
admin_ip: 10.47.17.178
admin_username: ansibleadm
admin_password: *******
svm_name: HE5NETAPP8200CL1

login: &login
hostname: "{{ 10.47.17.178 }}"
username: "{{ ansibleadm }}"
password: "{{ ******* }}"
https: true
validate_certs: false
feature_flags:
trace_apis: true
tasks:
- name: run ontap REST API command as cluster admin - get version
na_ontap_restit:
<<: *login
api: cluster/software
query:
fields: version
register: result
- assert: {that: result.status_code==200, quiet: true}

 

obassett
2,312 Views

Yes so looking at that it is likely as I suspected and @LaurentN mentioned. If you change the hosts line in the playbook to a linux host running all the pre-requisite python libraries (it can be the ansible host and specified as localhost) then it will likely work - though the hostname, username and password look a little odd - the bits inside the "{{ }}" should be the name of the variables, not the values - the variables are defined in admin_ip admin_username, admin_password - so those phrases should be in each of the login variables respectively.

LaurentN
2,300 Views

I would start with 

hosts: localhost

and

hostname: 10.47.17.178
username: ansibleadm
password: *******

 

There are some cases where you would want to run on another linux box, but this is less frequent.
And David documented an example using an inventory file to identify a set of ONTAP systems, but this requires to use connection: local which brings some issues of its own.

Public