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); } }
runner.setAgentPort(VirtualRouterGlobalProperty.AGENT_PORT); runner.setTargetIp(mgmtIp); runner.putArgument("pkg_virtualrouter", agentPackageName); if (CoreGlobalProperty.SYNC_NODE_TIME) { if (CoreGlobalProperty.CHRONY_SERVERS == null || CoreGlobalProperty.CHRONY_SERVERS.isEmpty()) { return; runner.putArgument("chrony_servers", String.join(",", CoreGlobalProperty.CHRONY_SERVERS));
runner.setAgentPort(ApplianceVmGlobalProperty.AGENT_PORT); runner.setTargetIp(mgmtIp); runner.putArgument("pkg_appliancevm", ApplianceVmGlobalProperty.AGENT_PACKAGE_NAME); if (CoreGlobalProperty.SYNC_NODE_TIME) { if (CoreGlobalProperty.CHRONY_SERVERS == null || CoreGlobalProperty.CHRONY_SERVERS.isEmpty()) { return; runner.putArgument("chrony_servers", String.join(",", CoreGlobalProperty.CHRONY_SERVERS));
runner.setTargetIp(Platform.getManagementServerIp()); runner.setPlayBookName(ANSIBLE_PLAYBOOK_NAME); runner.putArgument("pkg_consoleproxy", agentPackageName); if (CoreGlobalProperty.SYNC_NODE_TIME) { if (CoreGlobalProperty.CHRONY_SERVERS == null || CoreGlobalProperty.CHRONY_SERVERS.isEmpty()) { return; runner.putArgument("chrony_servers", String.join(",", CoreGlobalProperty.CHRONY_SERVERS));
runner.setAgentPort(SftpBackupStorageGlobalProperty.AGENT_PORT); runner.setPlayBookName(SftpBackupStorageConstant.ANSIBLE_PLAYBOOK_NAME); runner.putArgument("pkg_sftpbackupstorage", agentPackageName); if (CoreGlobalProperty.SYNC_NODE_TIME) { if (CoreGlobalProperty.CHRONY_SERVERS == null || CoreGlobalProperty.CHRONY_SERVERS.isEmpty()) { return; runner.putArgument("chrony_servers", String.join(",", CoreGlobalProperty.CHRONY_SERVERS));