> When I attempt to do it, the quotes are being parsed into JSON and the 
token is enclosed by backslashes.

Why do you believe this is the case, if it's due to the backslashes 
appearing in the task output that's just due to the output being encoded as 
json. The literal value is what that json represents not the json 
literally. Using the yaml callback [1] is a nice way to get a more 
"literal" value back in the output, although it's not perfect. The yaml 
formatting has also been introduced in the default callback in ansible-core 
2.13 [2] through the result_format option but that hasn't been released yet.

[1] 
https://docs.ansible.com/ansible/latest/collections/community/general/yaml_callback.html
[2] 
https://docs.ansible.com/ansible/devel/collections/ansible/builtin/default_callback.html#parameter-result_format

On Tuesday, February 22, 2022 at 10:01:20 AM UTC+10 1793...@gmail.com wrote:

>
> Hi there,
>
> I have a scenario where I have to pass a token in the URI Authorization 
> header, but it must be enclosed in double quotes as per my endpoint's 
> requirement. When I attempt to do it, the quotes are being parsed into JSON 
> and the token is enclosed by backslashes.
>
> How can I avoid Ansible evaluating those manually added double quotes? 
> Here's my URI task snippet.
>
> - name: Login
> uri:
> url: "test.com"
> method: GET
> validate_certs: no
> return_content: yes
> headers:
> Authorization: 'Token token="{{ token }}"'
> register: output
>
>
> Regards,
>
> Josue.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/86d5539b-af19-4473-b13f-85bbc847f9fdn%40googlegroups.com.

Reply via email to