Unsolved
10 Posts
0
859
June 6th, 2022 09:00
Error with api call to modify ntp settings on Unity
Using Ansible uri module to make api call to Unity and getting a 401 unauthorized response, however, the user I'm using is an admin. Here are the headers I'm sending which includes a token from a prior task. Anything I'm missing or another reason why it would come back and say it's not authorized?
| - name: Set NTP on storage array | |
| uri: | |
| timeout: 300 | |
| url: "https://{ { inventory_hostname }}/api/instances/ntpServer/0/action/modify" | |
| force_basic_auth: yes | |
| method: POST | |
| user: "{ { username }}" | |
| password: "{ { password }}" | |
| validate_certs: no | |
| body_format: json | |
| headers: | |
| Content-Type: "application/json" | |
| X-EMC-REST-CLIENT: true | |
| EMC-CSRF-TOKEN: "{ { token }}" | |
| body: "{ { ntp_body }}" | |
| environment: | |
| no_proxy: '*' | |
| register: result |
No Events found!



travelerdb
10 Posts
0
June 6th, 2022 09:00
Here's the actual response...
DELL-Sam L
Moderator
•
7.7K Posts
0
June 6th, 2022 16:00
Hello travelerdb,
Which unity system do you have and what is your current OE?
travelerdb
10 Posts
0
June 7th, 2022 03:00
Hi @DELL-Sam L ,
Here's info on the array...
Hope this helps
Thanks!
DELL-Sam L
Moderator
•
7.7K Posts
0
June 7th, 2022 14:00
Hello travelerdb,
Looking at your error that you posted it is stating that there is an issue with the account that you are using. I would double check your user name and password to ensure that it was entered correctly.
travelerdb
10 Posts
0
June 8th, 2022 11:00
@DELL-Sam L -- the user I'm using is an ldap user which is an admin on the array. Are there other permissions needed? From what I can see, this boils down to what headers is the unity api expecting when the authentication is happening for a POST call. In the previous task, I am successfully authenticating using basic auth and getting the EMC-CSRF-TOKEN which i'm adding as a header in the subsequent POST call, however, it seems the api is expecting something different. So, if we can answer the question around what headers the api is expecting, that would probably solve it as it seems to be redirecting the call to /cas/login currently.
DELL-Sam L
Moderator
•
7.7K Posts
0
June 8th, 2022 16:00
Hello travelerdb,
Let me look into this to see what I can find out.