2. Given that the center of a hyperbola is at the origin, and its foci are on the coordinate axes, the distance from point $P(-2,0)$ to its asymptotes is $\frac{2 \sqrt{6}}{3}$. A line with a slope of $\frac{\sqrt{2}}{2}$ passing through point $P$ intersects the hyperbola at points $A$ and $B$, and intersects the $y$-axis at point $M$. If $PM$ is the geometric mean of $PA$ and $PB$, then the semi-focal distance of the hyperbola is
2. $\sqrt{3}$ or $\sqrt{21}$.

Let the equation of the asymptote be $y=k x$.
From the given condition, we have $\frac{|-2 k|}{\sqrt{1+k^{2}}}=\frac{2 \sqrt{6}}{3} \Rightarrow k= \pm \sqrt{2}$.
Thus, the equations of the asymptotes of the hyperbola are $y= \pm \sqrt{2} x$. Therefore, we can assume the equation of the hyperbola to be
$$
2 x^{2}-y^{2}=\lambda(\lambda \neq 0) \text {. }
$$

Let $A\left(x_{1}, y_{1}\right), B\left(x_{2}, y_{2}\right)$. Then
$$
l_{A B}: y=\frac{\sqrt{2}}{2}(x+2) \text {. }
$$

Substituting into the equation of the hyperbola and eliminating $y$, we get
$$
3 x^{2}-4 x-2 \lambda-4=0 \text {. }
$$

When $\Delta=16+12(2 \lambda+4)>0$, i.e., $\lambda>-\frac{8}{3}$, the above equation has exactly two real roots, and
$$
\begin{array}{l}
x_{1}+x_{2}=\frac{4}{3}, x_{1} x_{2}=-\frac{2}{3}(\lambda+2) . \\
\text { By } P M^{2}=P A \cdot P B \\
\Rightarrow\left|\left(x_{1}+2\right)\left(x_{2}+2\right)\right|=4 \\
\Rightarrow\left|-\frac{2}{3}(\lambda+2)+2 \times \frac{4}{3}+4\right|=4 .
\end{array}
$$

Solving, we get $\lambda=2$ or 14.
Therefore, the semi-focal distance of the hyperbola is
$$
\sqrt{\frac{3 \lambda}{2}}=\sqrt{3} \text { or } \sqrt{21} \text {. }
$$