#re-enable rest api?

1 messages · Page 1 of 1 (latest)

whole sable
#

Hello, trying to use an ansible playbook that calls the api, but having issues. support had me run a curl command to see if it is working and getting an error there as well. I have verified that the user/password is correct. they refereed me here to help me get this resolved. thank you in advnace.

Command Ran: curl -X GET -u username:password -k "https://<ip_address>/api/cluster?fields=version"

error: curl: (7) failed to connect to <ip> port 443 after 4ms: connection refused

fair halo
#

Is it just REST or are you running into issues accessing System Manager or the SPI?

whole sable
#

I can get to system manager and spi via a web browser

zealous bridge
#

are you able to access system manager from the same host you are running curl from?
what ontap version is this?

whole sable
#

9.13.1

#

Yes I was using my laptop to run curl and can get to the system manager ui

zealous bridge
#

odd. System Manager uses REST in 9.13, so it's not something that would need to be enabled as long as system manager is working.

#

the curl works for me, so it's not syntax

zealous bridge
#

cli:

C:\Users\dawnr>curl -X GET -u admin:xxxxxxx -k "https://10.216.25.206/api/cluster?fields=version"
{
"version": {
"full": "NetApp Release 9.13.1: Mon Jun 19 13:36:41 UTC 2023",
"generation": 9,
"major": 13,
"minor": 1
},
"_links": {
"self": {
"href": "/api/cluster"
}
}
}

powershell:

PS C:\Users\dawnr> Invoke-RestMethod -uri "https://10.216.25.206/api/cluster?fields=version" -Method GET -Credential admin

version _links


@{full=NetApp Release 9.13.1: Mon Jun 19 13:36:41 UTC 2023; generation=9; major=13; minor=1} @{self=}

curl did not work in powershell the same way it did in the cli. so it just may depend on what shell you're running it from?

#

what was the support case, if you don't mind?

whole sable
#

Was trying to get a list of volumes through ansible. and i guess i shouldnt say support, it was the ansible room on here. 😄

whole sable
#

alright so i got that to work! i had the wrong IP in my ansible playbook, but now i still get the following when i run from ansible:

Error useing REST for version, error HTTPSConnectionPool (host= 'ip', port=443) Max retries exceeded with url: /api/cluster?fields=version (caused by Connecttimeouterror (<urllib3.connection.verifiedHTTPSConnection object at 1x7fe875eafa90>, connection to ip timed out (connect timeout = 60) error using REST cor version, status_code: none

zealous bridge
#

this i'm less familiar with. ansible is connecting to the cluster management lif? and there's no proxy between ansible and the cluster? or if there is, have you set a proxy in ansible?

whole sable
#

Yep cluster management lif, no proxy

zealous bridge
#

i'm not coming up with anything on why curl would work, but not ansible. If the ansible folks don't have anything now that curl is working, you might want to just open a support case.

whole sable
#

So is this an api error or an ansible error? do you happen to know?

zealous bridge
#

if curl and System Manager are working, I don't see this as an API error. This would be an ansible error.

#

but just for completeness, did it take more than a minute to return via curl?
is System Manager slow?

#

are you using a local or domain account when querying the api?

whole sable
#

Did not take more then 1 in to return, system manager doesnt seem slow, and a local account

zealous bridge
#

so that should rule out a temporary network issue
and rule out AD slowness and some of the odd, lesser known api issues with AD.

hot orbit
#

@whole sable did you get this solved?

whole sable
#

i did not yet, got caught up in a prod issue at work.

hot orbit
#

I've been doing quite a bit of Ansible lately, I might be able to help

#

Can you send the playbook?

whole sable
#
  • hosts: localhost
    gather_facts: true
    become: false

    collections:

    • netapp.ontap
    • netapp.Um_Info

    tasks:

    • name: Gather Volumes starting with
      netapp.ontap.na_ontap_rest_info:
      hostname: IP
      username: "user"
      password: "password"
      validate_certs: "false"
      https: "true"
      gather_subset:
      - aggregate_info
      - volume_info
      parameters:
      name: "TKG_*"
      is_svm_root: false
      fields: name
      register: volumes
hot orbit
#

Discord did a number on that formatting lol

whole sable
#

that it did LOL

hot orbit
#

The only thing different in mine is I do not have quotations around the username, password, etc but I don't think that's the problem

whole sable
#

yea i worked on the use a bit before i came in here, right now my user is full admin just for testing and getting it working

hot orbit
#

Let me know what happens once you've double checked the Ansible environment

whole sable
#

i guess is there another way to get a volume listing from ontapp via ansible besides rest through ansible?

#

i meet all the require ments from that page

hot orbit
#

I don't think the ZAPI will even work in 9.13

#

Can you run these and send the output

which python
which ansible
ansible --version
python --version

whole sable
#

bash-4.4# ansible --version
ansible [core 2.12.2]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.8/site-packages/ansible
ansible collection location = /home/runner/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.8.13 (default, Jun 14 2022, 17:49:07) [GCC 8.5.0 20210514 (Red Hat 8.5.0-13)]
jinja version = 2.11.3
libyaml = True

hot orbit
#

If you want to just open a Zoom I have about 40 minutes before my next meeting lol

#

Or are you on Teams?

whole sable
#

teams for us

#

pm sent