Mark, I believe I did my fan a little different than some have, it worked great for me.
I cut the fan hole out, insulated leaving enough for a 3/4" thick plywood frame to fit in against the metal roof.
I used Pl premium to adhere the plywood to the roof of the frame overlapped the roof struts, then I clamped it over night.
I then insulated between the roof struts to the plywood frame.
The next layer of insulation went between the wood struts I added for my ceiling plywood, it's all locked together..
When I installed the fan on top, there was no flimsy movement of the metal, and the plywood allowed me to secure the fan
with screws to it.
Used PL premium between all layers of the metal, plywood and insulation around the fan.. there's no vibration either when the fan is running or a 18mph wind with the hatch up..
On any gaps I add up to 3/8" with the insulation. I split the difference to both sides ran a bead of cheap caulk down the gap and taped with the aluminum tape..
Myself, I have stayed away from spray foam on any gaps where it could push out the metal and cause a hump on the exterior..
Maybe some of this will help you..