Thank you for the assistance. Added with two backslash to escape the
parenthesis.
- name: Check the JBOSS Server Uptime Domain mode
shell: "{{ CLI_SCRIPT }} --connect controller={{ item.hostname }}:{{
item.port }} --user={{ myusername }} --password={{ mypassword }} /host={{
item.host }}-{{ item.server }}/core-service=platform-mbean
/type=runtime:read-attribute\\(name=uptime\\)| awk '/result/ { print $3 }'"
register: uptime
delegate_to: remoteserver
ignore_errors: yes
On Sunday, 2 December 2018 13:18:40 UTC-5, Kai Stian Olstad wrote:
>
> On Sunday, 2 December 2018 19:08:54 CET Saravanan wrote:
> > Unable to use shell module to query the JBOSS uptime with CLI script in
> > Ansible. Can you please help to rectify the error?
> >
> > - name: Check the JBOSS Server Uptime Domain mode
> > shell: "{{ CLI_SCRIPT }} --connect controller={{ item.hostname }}:{{
> > item.port }} --user={{ myusername }} --password={{ mypassword }}
> /host={{
> > item.host }}-{{ item.server }}/core-service=platform-
> > mbean/type=runtime:read-attribute(name=uptime)| awk '/result/ { print $3
> }'"
> > register: uptime
> > delegate_to: remoteserver
> > ignore_errors: yes
> >
> > Error message:
> >
> > fatal: [127.0.0.1 -> remoteserver]: FAILED! => {"changed": true, "cmd":
> "
> > /opt/jboss/jboss-eap-7.2.0/bin/jboss-cli.sh --connect
> > controller=jbossserver:11011 --user=myusername --password=mypassword
> >
> /host=jbosshost-server/core-service=platform-mbean/type=runtime:read-attribute(name=uptime)
>
>
> > | awk '/result/ { print $3 }'", "delta": "0:00:00.278269", "end":
> > "2018-12-02 12:03:04.863388", "msg": "non-zero return code", "rc": 2,
> > "start": "2018-12-02 12:03:04.585119", "stderr": "/bin/sh: syntax error
> at
> > line 1: `(' unexpected", "stderr_lines": ["/bin/sh: syntax error at line
> 1:
> > `(' unexpected"], "stdout": "", "stdout_lines": []}
>
> It doesn't like the parenthesise so try to escape them both with a
> backslash.
>
>
> --
> 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/dac5479e-bf49-4b73-a9fe-caf93d097e85%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.