We demonstrate precise control of the coupling of each of two trapped ions to
the mode of an optical resonator. When both ions are coupled with near-maximum
strength, we generate ion--ion entanglement heralded by the detection of two
orthogonally polarized cavity photons. The entanglement fidelity with respect
to the Bell state Ψ+ reaches F≥(91.9±2.5). This result
represents an important step toward distributed quantum computing with cavities
linking remote atom-based registers