Interplay among superconductivity, charge density waves, and magnetism in EuMo6S8