  We estimate the mass of the inner ($<20$ kpc) Milky Way and the axis ratio of
its dark matter halo using globular clusters as tracers. At the same time, we
constrain the phase-space distribution of the globular cluster system. We use
the Gaia DR2 catalogue of 75 globular clusters' proper motions and recent
measurements of the proper motions of another 20 distant clusters obtained with
the Hubble Space Telescope. We describe the globular cluster system with a
2-component distribution function (DF), with a flat, rotating disc and a
rounder, more extended halo. While fixing the Milky Way's disc and bulge, we
let the mass and shape of the dark matter halo and we fit these two parameters,
together with other six describing the DF, with a Bayesian method. We find the
mass of the Galaxy within 20 kpc to be $M(<20{\,\rm kpc})=1.91^{+0.18}_{-0.17}
\times 10^{11} M_\odot$, of which $M_{\rm DM}(<20{\,\rm
kpc})=1.37^{+0.18}_{-0.17}\times 10^{11}M_\odot$ is in dark matter, and the
density axis ratio of the dark matter halo to be $q=1.30 \pm 0.25$. This
implies a virial mass $M_{\rm via} = 1.3 \pm 0.3 \times 10^{12} M_\odot$. Our
analysis rules out oblate ($q<0.8$) and strongly prolate halos ($q>1.9$) with
99\% probability. Our preferred model reproduces well the observed phase-space
distribution of globular clusters and has a disc component that closely
resembles that of the Galactic thick disc. The halo component follows a
power-law density profile $\rho \propto r^{-3.3}$, has a mean rotational
velocity of $V_{\rm rot}\simeq -14\,\rm km\,s^{-1}$ at 20 kpc, and has a mildly
radially biased velocity distribution ($\beta\simeq 0.2 \pm 0.07$, fairly
constant outside 15 kpc). We also find that our distinction between disc and
halo clusters resembles, although not fully, the observed distinction in
metal-rich ([Fe/H]$>-0.8$) and metal-poor ([Fe/H]$\leq-0.8$) cluster
populations.
