The nuclear modification factor R-AA and the azimuthal anisotropy coefficient v(2) ofprompt and nonprompt (i.e. those from decays of b hadrons) J/psi mesons, measured from PbPb and pp collisions at root S-NN = 2.76 rfeV at itheLHC, are reported. The results are presented in several event centrality intervals and several kinematic regions, for transverse momenta p(T) > 6.5 GeV/c and rapidity vertical bar y vertical bar < 2.4, extending down to p(T) = 3 GeV/c in the 1.6 < vertical bar y vertical bar < 2.4 range. The v(2) of prompt J/psi is found to be nonzero, but with no strong dependence on centrality, rapidity, or p(T) over the full kinematic range studied. The measured v(2) of nonprompt J/psi is consistent with zero. The R-AA of prompt J/psi exhibits a suppression that increases from peripheral to central collisions but does not vary strongly as a function of either y or pT in the fiducial range. The nonprompt J/psi RAA shows a suppression which becomes stronger as rapidity or p(T) increases. The v(2) and R-AA of open and hidden charm, and of open charm and beauty, are compared.