Ampere's law is valid (well, if you include the term added by Maxwell), no matter what. *BUT* the integral over \vec B \cdot \dl is in general difficult to do. It is only in a simple case like an (idealized) infinite wire that you can say that (with a circular closed loop centered around the wire) that vec B \cdot \dl = B dl and that, moreover, the magnitude of the B field is a constant which may be taken out of the integral.
It's the same as for Gauss' law for the electric field. It is *always* valid but the integral is easy to do only in specific cases with a lot of symmetry (spherical, cylindrical or planar symmetry). When a system is more complex and there is no obviosu symmetry, it is not that the law fails, it is rather than it is not very useful because it involves an integral very difficult to do. The reason books look at those special cases (infinte planes, infinite wires, infinite cylinders, etc) is that these are the only cases where the integrals involved in Gauss' and Ampere's laws are easy to carry out. It does not mean that the laws are not valid al the time, simply that they are not terribly useful.