public void perform(@Nonnull Run<?, ?> run, @Nonnull Node node, @Nonnull FilePath ws, @Nonnull Launcher launcher, @Nonnull TaskListener listener, EnvVars envVars)
throws InterruptedException, IOException
{
try {
CLIRunner runner = new CLIRunner(run, ws, launcher, listener);
String exe = AnsibleInstallation.getExecutable(ansibleName, AnsibleCommand.ANSIBLE_PLAYBOOK, node, listener, envVars);
AnsiblePlaybookInvocation invocation = new AnsiblePlaybookInvocation(exe, run, ws, listener, envVars);
invocation.setPlaybook(playbook);
invocation.setInventory(inventory);
invocation.setLimit(limit);
invocation.setTags(tags);
invocation.setSkippedTags(skippedTags);
invocation.setStartTask(startAtTask);
invocation.setBecome(become, becomeUser);
invocation.setSudo(sudo, sudoUser);
invocation.setForks(forks);
invocation.setCredentials(StringUtils.isNotBlank(credentialsId) ?
CredentialsProvider.findCredentialById(credentialsId, StandardUsernameCredentials.class, run) : null,
copyCredentialsInWorkspace);
invocation.setVaultCredentials(StringUtils.isNotBlank(vaultCredentialsId) ?
CredentialsProvider.findCredentialById(vaultCredentialsId, StandardCredentials.class, run) : null);
invocation.setExtraVars(extraVars);
invocation.setAdditionalParameters(additionalParameters);
invocation.setDisableHostKeyCheck(disableHostKeyChecking);
invocation.setUnbufferedOutput(unbufferedOutput);
invocation.setColorizedOutput(colorizedOutput);
if (!invocation.execute(runner)) {
throw new AbortException("Ansible playbook execution failed");
}
} catch (IOException ioe) {
Thread.sleep(10000);
Util.displayIOException(ioe, listener);
ioe.printStackTrace(listener.fatalError(hudson.tasks.Messages.CommandInterpreter_CommandFailed()));
throw ioe;
} catch (AnsibleInvocationException aie) {
Thread.sleep(10000);
listener.fatalError(aie.getMessage());
throw new AbortException(aie.getMessage());
}
}