Unable to execute SonarQube in docker container through ansible playbook

Hi ,

In docker container I am able to run gradle sonarqube build command.

It generates build file and getting BUILD SUCCESSFUL.

sonarqube@6598bfb8b3d0:/opt/sonarqube/samplhelloworld$ gradle sonarqube

Task :compileJava UP-TO-DATE
Task :processResources NO-SOURCE
Task :classes UP-TO-DATE
Task :compileTestJava NO-SOURCE
Task :processTestResources NO-SOURCE
Task :testClasses UP-TO-DATE
Task :test NO-SOURCE
Task :sonarqube

BUILD SUCCESSFUL in 11s
2 actionable tasks: 1 executed, 1 up-to-date

But , When I am trying to execute from same command from the Ansible playbook build is failed.

TASK [Running the sonarqube] ************************************************************************************************************************************************************************

fatal: [101.53.157.156]: FAILED! => {“changed”: true, “cmd”: [“docker”, “exec”, “-it”, “sonargradle3.0”, “/bin/bash”, “-c”, “cd samplhelloworld ; gradle sonar”], “delta”: “0:00:41.128338”, “end”: “2019-10-07 10:15:08.621337”, “msg”: “non-zero return code”, “rc”: 1, “start”: “2019-10-07 10:14:27.492999”, “stderr”: “”, “stderr_lines”: , “stdout”: “\r\nWelcome to Gradle 5.6.2!\r\n\r\nHere are the highlights of this release:\r\n - Incremental Groovy compilation\r\n - Groovy compile avoidance\r\n - Test fixtures for Java projects\r\n - Manage plugin versions via settings script\r\n\r\nFor more details see https://docs.gradle.org/5.6.2/release-notes.html\r\n\r\nStarting a Gradle Daemon (subsequent builds will be faster)\r\n> Task :compileJava\r\n> Task :processResources NO-SOURCE\r\n> Task :classes\r\n> Task :compileTestJava NO-SOURCE\r\n> Task :processTestResources NO-SOURCE\r\n> Task :testClasses UP-TO-DATE\r\n> Task :test NO-SOURCE\r\n> Task :sonarqube FAILED\r\n\r\nFAILURE: Build failed with an exception.\r\n\r\n* What went wrong:\r\nExecution failed for task ‘:sonarqube’.\r\n> Unable to execute SonarQube\r\n\r\n* Try:\r\nRun with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.\r\n\r\n* Get more help at https://help.gradle.org\r\n\r\nBUILD FAILED in 39s\r\n2 actionable tasks: 2 executed”, “stdout_lines”: ["", “Welcome to Gradle 5.6.2!”, “”, “Here are the highlights of this release:”, " - Incremental Groovy compilation", " - Groovy compile avoidance", " - Test fixtures for Java projects", " - Manage plugin versions via settings script", “”, “For more details see https://docs.gradle.org/5.6.2/release-notes.html”, “”, “Starting a Gradle Daemon (subsequent builds will be faster)”, “> Task :compileJava”, “> Task :processResources NO-SOURCE”, “> Task :classes”, “> Task :compileTestJava NO-SOURCE”, “> Task :processTestResources NO-SOURCE”, “> Task :testClasses UP-TO-DATE”, “> Task :test NO-SOURCE”, "> Task :sonarqube FAILED", “”, “FAILURE: Build failed with an exception.”, “”, " What went wrong:", “Execution failed for task ‘:sonarqube’.”, “> Unable to execute SonarQube”, “”,* “* Try:”, “Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.”, “”, “* Get more help at https://help.gradle.org”, “”, “BUILD FAILED in 39s”, “2 actionable tasks: 2 executed”]}.