Source:
private void changeVncEncryption(boolean enable) { VdsStatic vdsStatic = getParameters().getVdsStaticData(); AnsibleCommandBuilder command = new AnsibleCommandBuilder() .hostnames(vdsStatic.getHostName()) .logFilePrefix("ovirt-host-vnc-encryption-ansible") .logFileName(vdsStatic.getHostName()); if (enable) { command.playbook(AnsibleConstants.VNC_ENCRYPTION_ON_PLAYBOOK); } else { command.playbook(AnsibleConstants.VNC_ENCRYPTION_OFF_PLAYBOOK); } AuditLogable logable = new AuditLogableImpl(); logable.setVdsName(getVds().getName()); logable.setVdsId(getVds().getId()); logable.setCorrelationId(getCorrelationId()); auditLogDirector.log(logable, AuditLogType.VDS_ANSIBLE_INSTALL_STARTED); try { AnsibleReturnValue ansibleReturnValue = ansibleExecutor.runCommand(command); if (ansibleReturnValue.getAnsibleReturnCode() != AnsibleReturnCode.OK) { log.error("Failed to execute Ansible change VNC Encryption playbook. Please check logs for more details: {}", command.logFile()); throw new EngineException(EngineError.GeneralException, String.format( "Failed to execute Ansible change VNC Encryption playbook. Please check logs for more details: %1$s", command.logFile())); } } catch (IOException | InterruptedException ex) { log.error("Failed to execute Ansible change VNC Encryption playbook. Please check logs for more details: {}", ex); throw new EngineException(EngineError.GeneralException, String.format( "Failed to execute Ansible change VNC Encryption playbook. Please check logs for more details: %1$s", ex.toString())); } auditLogDirector.log(logable, AuditLogType.VDS_ANSIBLE_INSTALL_FINISHED); }

Target:
private void changeVncEncryption(boolean enable) { VdsStatic vdsStatic = getParameters().getVdsStaticData(); AnsibleCommandBuilder command = new AnsibleCommandBuilder() .hostnames(vdsStatic.getHostName()) .logFilePrefix("ovirt-host-vnc-encryption-ansible") .logFileName(vdsStatic.getHostName()); if (enable) { command.playbook(AnsibleConstants.VNC_ENCRYPTION_ON_PLAYBOOK); } else { command.playbook(AnsibleConstants.VNC_ENCRYPTION_OFF_PLAYBOOK); } AuditLogable logable = new AuditLogableImpl(); logable.setVdsName(getVds().getName()); logable.setVdsId(getVds().getId()); logable.setCorrelationId(getCorrelationId()); auditLogDirector.log(logable, AuditLogType.VDS_ANSIBLE_INSTALL_STARTED); try { AnsibleReturnValue ansibleReturnValue = ansibleExecutor.runCommand(command); if (ansibleReturnValue.getAnsibleReturnCode() != AnsibleReturnCode.OK) { log.error("Failed to execute Ansible change VNC Encryption playbook on host '" + vdsStatic.getHostName() + "'. Please check logs for more details: {}", command.logFile()); throw new EngineException(EngineError.GeneralException, String.format( "Failed to execute Ansible change VNC Encryption playbook. Please check logs for more details: %1$s", command.logFile())); } } catch (IOException | InterruptedException ex) { log.error("Failed to execute Ansible change VNC Encryption playbook on host '" + vdsStatic.getHostName() + "'. Please check logs for more details: {}", ex); throw new EngineException(EngineError.GeneralException, String.format( "Failed to execute Ansible change VNC Encryption playbook. Please check logs for more details: %1$s", ex.toString())); } auditLogDirector.log(logable, AuditLogType.VDS_ANSIBLE_INSTALL_FINISHED); }