3-Lie Algebras, Ternary Nambu-Lie algebras and the Yang-Baxter equation