What are the differences between primary and secondary line of defense? What factors interfere with these mechanisms?

What are the differences between primary and secondary line of defense? What factors interfere with these mechanisms? How are these levels of immunity affected in a child, an elderly person, or a person with a chronic disease? Include active, passive, innate, and acquired immunity.