We study a Markovian queueing system with unreliable servers and two possible groups of servers taking two different types of vacations. Once the number of idle of servers reaches one of the two critical numbers in the system, a group of servers will take a single synchronous vacation (or leave for doing a secondary job). After taking the vacation, the servers return to attend the queue (or stay idle for the next arriving customer). Therefore, there can be a maximum of two groups of servers taking two different types of vacations at a time (doing some secondary jobs). The servers are subject to failure when attending the queue. The stability condition for the system and the stationary performance measures are developed by using the matrix-analytical method. A cost model is constructed to determine the optimal vacation policy and the optimal service rate of each server. Some numerical results are presented to illustrate the optimization procedures.