Distribution of the entangled state of trapped atomic ions to long distance using quantum repeater protocol is considered. Indeed, the long distance is divided into short parts, and then using entanglement generation and entanglement swapping techniques in optomechanical cavities, the entanglement is distributed. To do the task, we perform interaction between trapped atomic ions in optomechanical cavities, operate proper measurements on trapped ions and also make Bell state measurement as a well-known way to swap the entanglement. Accordingly, the entanglement is distributed between target ions with satisfactory values of success probability and entanglement degree. The effects of detuning and amplitude of pump laser on the entanglement and success probability are evaluated. The fluctuations of entanglement and success probability are decreased by increasing of detuning. Via increasing the amplitude of pump laser, the maxima of entanglement are repeated more times and success probability undergoes the collapse-revival phenomenon.