Instead of treating truth or lie separately you’d better treat this as a part of dharma or adharma. Always practice dharma.
When no other alternative is possible, adharma might become necessary to protect a great dharma. First part of your question should be justfied from this point of view.
You should always tell the truth; but in some cases you will have to give up this advice.
satyam bruyat priyam bruyat na bruyat satyam apriyam…
satyam bruyat priyam bruyat
na bruyat satyam apriyam
priyam ca nanrutam bruyat
esha dharmah sanatanah
Speak the truth, speak pleasantly,
Do not speak the truth in an unpleasant manner
Even if pleasant, do not speak untruth,
This is the path of eternal righteousness.
The consequence of lying is illustrated in the story of Yudhishthira's dog (in the Mahabharata). It indicates the obstacle that can happen in one's spiritual path even through a light lie. And the difficulty of practising the truth can be seen in the story of Harishchandra
Often, the intensity of lying varies according to the situation, your profession, age, relation, etc.
If you are a teacher it is your duty to be a role model for all your students. The same is true in the case of parents and their children. So you should always tell the truth.
But if you are a doctor, sometimes you may have to lie to hide some serious illness to appease the patient and give him confidence when there is no alternative solution. The same is true in the case of a first-aid provider. Even then he never hides the truth from the relatives.
If one can imagine the negative effects, before telling the truth, shocking news is often told starting with a light lie. (Eg: Death of close relatives or friends)