private void deploySaltState() { if (CoreGlobalProperty.UNIT_TEST_ON) { return; } asf.deployModule(SftpBackupStorageConstant.ANSIBLE_MODULE_PATH, SftpBackupStorageConstant.ANSIBLE_PLAYBOOK_NAME); }
private void cleanup() { // deleting source files. Then next time ansible is called, AnsibleChecker returns false that lets ansible run for (AnsibleChecker checker : checkers) { checker.deleteDestFile(); } }
@Override public Object call() { final RunAnsibleReply reply = new RunAnsibleReply(); run(new Completion(msg) { @Override public void success() { bus.reply(msg, reply); } @Override public void fail(ErrorCode errorCode) { reply.setError(errorCode); bus.reply(msg, reply); } }); return null; } });
private void configAgentSsh() { Boolean passwordAuth = VirtualRouterGlobalConfig.SSH_LOGIN_PASSWORD.value(Boolean.class); String script; if (!passwordAuth) { script = "sudo sed -i \"/PasswordAuthentication /c PasswordAuthentication no\" /etc/ssh/sshd_config\n"+ "sudo service ssh restart\n"; } else { script = " sudo sed -i \"/PasswordAuthentication /c PasswordAuthentication yes\" /etc/ssh/sshd_config\n"+ "sudo service ssh restart\n"; } new Ssh().shell( script ).setTimeout(300).setPrivateKey(asf.getPrivateKey()).setUsername("vyos").setHostname(mgmtNicIp).setPort(22).runErrorByExceptionAndClose(); trigger.next(); }
@Override public String getName() { return getSyncSignature(); }
public void doWalk(File start, Collection result) throws IOException { walk(start, result); } }
@Override public String getSyncSignature() { return String.format("run-anisble-for-host-%s", msg.getTargetIp()); }
public void addSrcDestPair(String srcFilePath, String destFilePath) { srcDestPairs.add(new SrcDestPair(srcFilePath, destFilePath)); }
private boolean runChecker() { for (AnsibleChecker checker : checkers) { if (checker.needDeploy()) { logger.debug(String.format("checker[%s] reports deploy is needed", checker.getClass())); return true; } } return false; }
@Override @MessageSafe public void handleMessage(Message msg) { if (msg instanceof RunAnsibleMsg) { handle((RunAnsibleMsg) msg); } else { bus.dealWithUnknownMessage(msg); } }
public void prepare() { DebugUtils.Assert(targetIp != null, "targetIp cannot be null"); try { setupHostsFile(); } catch (IOException e) { throw new CloudRuntimeException(e); } } }
private void setupPublicKey() throws IOException { File pubKeyFile = PathUtil.findFileOnClassPath(AnsibleConstant.RSA_PUBLIC_KEY); String script = PathUtil.findFileOnClassPath(AnsibleConstant.IMPORT_PUBLIC_KEY_SCRIPT_PATH, true).getAbsolutePath(); if (localPublicKey) { ShellUtils.run(String.format("sh %s %s", script, pubKeyFile.getAbsolutePath())); } else { setupPublicKeyOnRemote(); } }
@Override public boolean start() { if (!CoreGlobalProperty.UNIT_TEST_ON) { asf.deployModule(CephGlobalProperty.BACKUP_STORAGE_MODULE_PATH, CephGlobalProperty.BACKUP_STORAGE_PLAYBOOK_NAME); } return true; }
@Override public boolean start() { if (!CoreGlobalProperty.UNIT_TEST_ON) { asf.deployModule(FusionstorGlobalProperty.BACKUP_STORAGE_MODULE_PATH, FusionstorGlobalProperty.BACKUP_STORAGE_PLAYBOOK_NAME); } return true; }
private void deployAnsible() { if (CoreGlobalProperty.UNIT_TEST_ON) { return; } asf.deployModule(VirtualRouterConstant.ANSIBLE_MODULE_PATH, VirtualRouterConstant.ANSIBLE_PLAYBOOK_NAME); }
private void deploySaltState() { if (CoreGlobalProperty.UNIT_TEST_ON) { return; } asf.deployModule("ansible/consoleproxy", ANSIBLE_PLAYBOOK_NAME); }
private void deployAnsible() { if (CoreGlobalProperty.UNIT_TEST_ON) { return; } asf.deployModule(ApplianceVmConstant.ANSIBLE_MODULE_PATH, ApplianceVmConstant.ANSIBLE_PLAYBOOK_NAME); }
private void deployAnsibleModule() { if (CoreGlobalProperty.UNIT_TEST_ON) { return; } asf.deployModule(KVMConstant.ANSIBLE_MODULE_PATH, KVMConstant.ANSIBLE_PLAYBOOK_NAME); }
@Override public boolean start() { if (!CoreGlobalProperty.UNIT_TEST_ON) { asf.deployModule(CephGlobalProperty.PRIMARY_STORAGE_MODULE_PATH, CephGlobalProperty.PRIMARY_STORAGE_PLAYBOOK_NAME); } return true; }
@Override public boolean start() { if (!CoreGlobalProperty.UNIT_TEST_ON) { asf.deployModule(FusionstorGlobalProperty.PRIMARY_STORAGE_MODULE_PATH, FusionstorGlobalProperty.PRIMARY_STORAGE_PLAYBOOK_NAME); } startCleanupThread(); FusionstorGlobalConfig.IMAGE_CACHE_CLEANUP_INTERVAL.installUpdateExtension(new GlobalConfigUpdateExtensionPoint() { @Override public void updateGlobalConfig(GlobalConfig oldConfig, GlobalConfig newConfig) { if (imageCacheCleanupThread != null) { imageCacheCleanupThread.cancel(true); } startCleanupThread(); } }); return true; }