DC solenoid overheat protection
Let's see:
12V * 2A is 24W
It really matters what the duty cycle of these solenoids are, because 5 seconds averaged over 1 minute would look like a 2W load (5/60*24W = 2W) and over 2 minutes would look like 1W.
So with 40 of these solenoids that would be somewhere in the 80W to 40W of thermal power that needs to be dissipated, which would probably mean a fan of some sort, just from experience I'll bet you'd need 30 to 50 CFM (cubic feet a minute).
If you want to reduce the thermal/electrical burden of the solenoids a hit and hold strategy can work (look in the datasheet and it should tell you the holding current).
A good circuit for hit and hold is right here:
How do I use a hit and hold circuit with a solenoid?
1N4007 will work if it can handle the current when the solenoid shuts off.