public void run(Completion completion) { try { if (!isNeedRun()) { completion.success(); return; } putArgument("pip_url", String.format("http://%s:8080/zstack/static/pypi/simple", restf.getHostName())); putArgument("trusted_host", restf.getHostName()); putArgument("yum_server", String.format("%s:8080", restf.getHostName())); putArgument("remote_user", username); if (password != null && !password.isEmpty()) { putArgument("remote_pass", password); } putArgument("remote_port", Integer.toString(sshPort)); logger.debug(String.format("starts to run ansible[%s]", playBookPath == null ? playBookName : playBookPath)); new PrepareAnsible().setTargetIp(targetIp).prepare(); setupPublicKey(); callAnsible(completion); } catch (SshException e) { throw new OperationFailureException(operr("User name or password or port number may be problematic")); } catch (Exception e) { throw new CloudRuntimeException(e); } }