Germany's parliament has passed a bill to loosen the country's strict debt rule to enable higher defense spending.