--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/15ce9f57-e79c-44bc-ad1f-0c6aa958309d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Instead of json.token you need to reference the variable that you registered. Such as:authentication.json.token`json` is a key off of the registered var from the task.
We're evaluating Ansible and learning how to use it. I'm trying to using Ansible to call the Ansible api's. I have an issue with the uri module in trying to reference the response from the authtoken API to use in subsequent requests. Per the docs, the return_content option is supposed to put the json response in the dictionary with the name json. I'm ASSUMING the dictionary is the repository for variables. So, when these tasks run, the second one throws an error saying that the json varaible does not exist.--Can someone tell me how I can reference the response as a variable?The tasks I wrote is:- uri:method: POSTHEADER_Content-Type: application/jsonbody: '{ "username" : "myusername", "password" : "mypassword" }'validate_certs: noreturn_content: yesregister: authentication- uri:method: GETHEADER_Authorization: TOKEN {{ json.token }}validate_certs: noreturn_content: yes
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/15ce9f57-e79c-44bc-ad1f-0c6aa958309d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.