The topological state of a two-dimensional triplet superconductor may be changed by an appropriate addition of magnetic impurities. A ferromagnetic magnetic chain at the surface of a superconductor with spin-orbit coupling may eliminate the edge states of a finite system giving rise to localized zero modes at the edges of the chain. The coexistence/competition between the two types of zero modes is considered. The reduction of the system to an effective $1d$ system gives partial information on the topological properties but the study of the two sets of zero modes requires a two-dimensional treatment. Increasing the impurity density from a magnetic chain to magnetic islands leads to a finite Chern number. At half-filling small concentrations are enough to induce chiral modes.