URL module can not use body from role task

49 views
Skip to first unread message

Phill Pafford

unread,
Jul 13, 2015, 7:04:18 PM7/13/15
to ansible...@googlegroups.com
How can I execute a REST call to an API from a role

http://docs.ansible.com/uri_module.html

- name: add ssh key to stash via api
uri:
url: "{{stash_api_url}}"
method: POST
body: '{"text": "value"}'
body_format: json
status_code: 201
HEADER_Content-Type: "application/json"
register: ssh_key_added_to_stash

ERROR: body is not a legal parameter in an Ansible task or handler
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

Brian Coca

unread,
Jul 13, 2015, 7:27:07 PM7/13/15
to ansible...@googlegroups.com
indent everything after uri, up to register (non inclusive).



--
Brian Coca

Phill Pafford

unread,
Jul 14, 2015, 7:39:05 AM7/14/15
to ansible...@googlegroups.com
DOH! Thanks that helped! still doesn't solve my issue but at least it does solve it executing
Reply all
Reply to author
Forward
0 new messages