The equilibrium behavior of vortices in a classical two-dimensional (2D) XY model with uncorrelated random phase shifts is investigated. The model describes Josephson-junction arrays with positional disorder and has ramifications in a number of other bond-disordered 2D systems. The vortex Hamiltonian is that of a Coulomb gas in a background of quenched random dipoles, which is capable of forming either a dielectric insulator or a plasma. We confirm a recent suggestion by Nattermann, Scheidl, Korshunov, and Li [J. Phys. (France) I 5, 565 (1995)] and by Cha and Fertig [Phys. Rev. Lett. 74, 4867 (1995)] that, when the variance σ of random phase shifts is sufficiently small, the system is in a phase with quasi-long-range order at low temperatures, without a reentrance transition. This conclusion is reached through a nearly exact calculation of the single-vortex free energy and a Kosterlitz-type renormalization group analysis of screening and random polarization effects from vortex-antivortex pairs. There is a critical disorder strength σc, above which the system is in the paramagnetic phase at any nonzero temperature. The value of σc is found not to be universal, but generally lies in the range 0<σc<π/8. In the ordered phase, vortex pairs undergo a series of spatial and angular localization processes as the temperature is lowered. This behavior, which is common to many glass-forming systems, can be quantified through approximate mappings to the random energy model and to the directed polymer on the Cayley tree. Various critical properties at the order-disorder transition are calculated.