On Friday, 21 September 2018 14.56.34 CEST Narahari 'n' Savitha wrote:
> Hello:
> 
> Here is the command I am trying to run ansible adhoc 
> 
> ansible -o APP_SERVERS_GROUP[0] -i 
> ~/HOSTS/v2/DATA_LAB/DIT/DIT1_DEV/DIT1__LOCAL_CURR/ -m shell -a "{{ curl -sk 
> localhost:8080/Log4JControl/version.jsp | trim }}" -u ANSIBLE_USER
> 
> The output I get is this
> 
> dit1_dev.cucumber.com | FAILED! => {"failed": true, "msg": "template error 
> while templating string: expected token 'end of print statement', got 
> 'localhost'. String: {{ curl -sk localhost:8080/Log4JControl/version.jsp | 
> trim }}"}
> 
> Is this invalid syntax or am I doing this all wrong ?

In a template(between {{ and }}) you can only use template language call Jinja
not shell commands.
http://jinja.pocoo.org/docs/2.10/templates/

> All I am trying to avoid is the \r\n chars in the output.

You need to use pure shell command

-a "curl -sk localhost:8080/Log4JControl/version.jsp | tr -d '\r\n'"

-- 
Kai Stian Olstad


-- 
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/24412610.6mF9tstrkV%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to