I would like to get the correct return code from the called batch file so that my Ansible task fails if the batch call fails.
This seems to be impossible. Executing the given command directly in the CMD works and %errorlevel% is != 0. Executing it within Ansible rc is always "0" - except if the executable of the command is not found...
Any idea?
- name: undeploy ...
win_shell: "set nopause=true && F:/xyz/wildfly-8.2.0.Final/bin/jboss-cli.bat --connect controller=myhost.net --user="myuser" --password="verysecret" --command=\"deploy F:\warfolder\mywar.war --server-groups=main-server-group\""
args:
executable: cmd