You could in principle have a bar which is magnetised with one pole in the middle and the opposite pole to that at each end. E.g., glue the N poles of two magnets together.
As far as is known, a monopole is also possible, but none has ever been found.