Short answer: spray about an inch to the roof deck and gable walls. Take specific note of any fire rated surfaces and know the foam will potentially lessen that rating.
Long answer is that you should think hard about air, ventilation and the requirements of envelope (cladding, moisture barrier, air barrier, thermal barrier. Insulating the roof deck will "hot deck" the shingles and shorten their life. Typically you would back vent the roof deck with a 1 inch airspace that connects the soffits to the ridge vent. This can be done in many ways, commonly with vent chutes. If that is done, you have the first function of cladding completed. Now what you install on the inside of the air space must be a moisture, air and thermal barrier. Spray foam is a good source of all of these. Something like icynene, polyurethane foam or polystyrene foam, give you an air barrier, thermal barrier and various moisture "perm" rating. Polystyrene can be a moisture stopper, which can be a problem. Next, we commonly add fiberglass to get the r-value up to the code or desired amount. Fiberglass is fine, just understand that you don't want the kraft paper to be on the inside of the assembly AND acting as the moisture barrier. Commonly they have perforated face insulation to allow "draining".
I would point you to insulating the cooling equipment and duct before i would condition the attic. If you can insulate the cooling equipment to get the surface temperature above the dew point, you will probably mitigate the energy loss and moisture issues. Changing the attic has plenum rating implications, is the attic air part of the conditioned zone or inactive conditioned space? I think the fix of insulating the equipment is a better answer to the problem. Conditioning the attic could have other benefits and other problems that don't exist yet.
Good point about 'fire rating'... Depending on attic configuration, exposed spray foam insulation must either have a thermal or ignition barrier (typically an intumescent coating), although a few foam products are rated as such. However, I wouldn't be too concerned with impact on shingle life.
When the residential codes first allowed unvented attics (2006 IRC), some shingle manufacturers voided warranty if roof deck wasn't ventilated. However, subsequent research demonstrated that spray foam on underside of roof deck had less impact on shingle temperature than the color of the shingle! I'd be interested in knowing if any shingle manufacturers are still making an issue of this.
It's worth pointing out that the R-value of the foam must meet IRC Section R806.5 requirements. For example, IECC Climate Zones 4A & 4B must have at least R-15 air impermeable insulation on the roof deck. I believe Noah is in SE Texas (CZ-2A), in which case only R-5 air impermeable insulation is required. Also, just to clarify, it typically takes at least 3.5 inches of open cell foam to qualify as an air barrier. An inch of closed cell foam may or may not be an air barrier depending on the specific product.
Lastly, constructing a hybrid assembly (e.g., foam + fiberglass on roof deck) is not straightforward. In particular, the fiberglass must be held in good contact with the foam without compression. Here's a discussion in Home Performance Forum archives on that topic: https://homeenergypros.org/hpforum-archive#/discussion/3667
Concur with Mick Lane's ending, fully insulating attic can have unattended consequences, and to go further, that can reduce shingle life, create mold, chemical contamination (bad foam job), reduce air flow creating 'sick house' syndrome, or even destroy roof structure. Working w firemen they don't appreciate foamed houses smoke developed is a big problem.
Insulate the equipment and ducts if at all possible, I suggest ROCK WOOL, it is resistant to moisture damage and is stiff enough to maintain shape with relatively little attachment.
While in the attic, think about more ceiling insulation, enlarging or installing gable end vents. I'd aim for 18 inches of insulation & 3 to 4 sf vent in ea gable end. If DIY aim higher on insulation, it's real hard to fully fluff it & deeper it is more likely workers will manage to get some of it back in place when they are finished fixing wiring, lights, etc
Does the roof have a vented soffit and ridge vent?
Honestly research shows its best to create a sealed conditioned attic buy putting the insulation on the outside of the roof deck. So, continuous on the roof osb, w/ shingles or metal roofing on top insulation.
That said we have a builder that puts 1" rigid foam in the rafter space (1" deep) to allow a vented roof deck. Then flash foam 1" closed cell foam, then net and blow the rest of the 2' rafters. Then drywall. He hasn't had any issues yet and no complaints.
On houses with trusses we have done R38 with closed cell foam. We also then conditioned the space with a dedicated supply and return. This seemed to me to be a waste of energy. I would have recommended just spray foaming the ceiling on the attic side 2". Closed Cell foam all duct work. then blown fiberglass to around an R60.