Hardcoding this works:

{
  "text": "my value here"
}

On Tuesday, July 14, 2015 at 12:32:25 PM UTC-4, Phill Pafford wrote:
>
> I'm trying to dynamically create the JSON response needed for my REST 
> request, I can hard code the JSON var and it works but when I add a 
> variable it fails.
>
>
> - name: add ssh key to stash via api
>   uri:
>     url: "{{stash_api_url}}"
>     user: "{{stash_username}}"
>     password: "{{stash_password}}"
>     force_basic_auth: yes
>     method: POST
>     body: '''{"text":"{{stash_ansible_ssh_key_contents.stdout}}"}'''
>     body_format: json
>     status_code: 201,409
>     HEADER_Content-Type: "application/json"
>     register: ssh_key_added_to_stash
>     when: stash_ansible_ssh_key_contents.stdout != -1
>
>
> tried:
>
> - body: '{"text":"{{stash_ansible_ssh_key_contents.stdout}}"}'
>
> - body: ''{"text":"{{stash_ansible_ssh_key_contents.stdout}}"}''
>
> - body: '''{"text":"{{stash_ansible_ssh_key_contents.stdout}}"}'''
>
>
> if I reverse the single and double quotes there is still an issue
>
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/06295d5d-4ca1-410b-90cc-fd1a7c30a6cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to