But what exactly do you mean with "lights/fans"? I would strongly advise you not to touch anything that's running at mains voltage, unless you know exactly what you are doing.
If you need to switch mains voltage, don't do it directly. There are cheap wireless remote switches available, you can use those and hook the remote to the ESP without risking to electrocute yourself.
I don't know Yun's voltage supply, but if it is 5V instead of 3.3V, you will only need a buffer to convert ESP 3.3V output into 5V to turn on the relay.
This buffer can be build in several ways:
1.- Buying a buffer.
2.- Using a transistor in saturation:
Where it says Arduino input, it should appear relay input.
I think option 2 is better and cheaper than first one.
Hope it is helpful!
R