i'm trying execute remote command via ansible requires gathering pid of process:
ansible webserver -m shell -a 'jstack -l $(pgrep -f java)'
however seems ansible not able expand shell command contained in parenthesis (tried grave accent):
127.0.0.1 | failed | rc=1 >> usage: jstack [-l] <pid>
executing command in expansion reveals expansion not take place:
ansible webserver -a 'echo $(pgrep -f java)' 192.168.0.1 | success | rc=0 >> $(pgrep -f java)
Comments
Post a Comment