I want to design a second order digital all pass filter with the transfer function given by $$H(z)=\frac{a_2 +a_1 z^{-1}+z^{-2}}{1+a_1 z^{-1}+a_2 z^{-2}}$$ The input to this filter has frequencies ranging from $1$ to $8\ \rm kHz$. The sampling frequency is $20\ \rm kHz$.
How to design the filter coefficients $a_1, a_2$ such that for a particular input frequency, I have to apply 180 degree phase shift? The frequency which is given a 180 degree phase shift will vary. So, how to vary the filter coefficients based on which frequency has to be phase shifted by 180 degree?