8. Let $f(x)=\cos 2x-2a(1+\cos x)$ have a minimum value of $-\frac{1}{2}$. Then $a=$ $\qquad$ .
$$
\begin{array}{l}
\text { 8. }-2+\sqrt{3} \\
f(x)=2 \cos ^{2} x-1-2 a-2 a \cos x \\
=2\left(\cos x-\frac{a}{2}\right)^{2}-\frac{1}{2} a^{2}-2 a-1
\end{array}
$$
(1) When $a>2$, $f(x)$ reaches its minimum value $1-4a$ when $\cos x=1$;
(2) When $a>2$ or $a<-2$, the minimum value of $f(x)$ cannot be $-\frac{1}{2}$, then $-\frac{1}{2} a^{2}-2 a-1=-\frac{1}{2}$. Solving this, we get $a=-2+\sqrt{3}, a=-2-\sqrt{3}$ (discard).
