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 ?
All I am trying to avoid is the \r\n chars in the output.
-Narahari
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'"