The motion of a rolling ball actuated by internal point masses that move inside the ball's frame of reference is considered. The equations of motion are derived by applying Euler-Poincaré's symmetry reduction method in concert with Lagrange-d'Alembert's principle, which accounts for the presence of the nonholonomic rolling constraint. As a particular example, we consider the case when the masses move along internal rails, or trajectories, of arbitrary shape and fixed within the ball's frame of reference. Our system of equations can treat most possible methods of actuating the rolling ball with internal moving masses encountered in the literature, such as circular motion of the masses mimicking swinging pendula or straight line motion of the masses mimicking magnets sliding inside linear tubes embedded within a solenoid. Moreover, our method can model arbitrary rail shapes and an arbitrary number of rails such as several ellipses and/or figure eights, which may be important for future designs of rolling ball robots. For further analytical study, we also reduce the system to a single differential equation when the motion is planar, that is, considering the motion of the rolling disk actuated by internal point masses, in which case we show that the results obtained from the variational derivation coincide with those obtained from Newton's second law. Finally, the equations of motion are solved numerically, illustrating a wealth of complex behaviors exhibited by the system's dynamics. Our results are relevant to the dynamics of nonholonomic systems containing internal degrees of freedom and to further studies of control of such systems actuated by internal masses.