Harbor Freight flagpoles are often mentioned: https://www.harborfreight.com/20-ft-telescoping-flag-pole-kit-64344.html The quality is very good.
A model 64344 bought in August 2023 is exactly 40 mm at the top, so this adapter bushing fits smoothly inside it: https://www.amazon.com/gp/product/B0BGKWW1LZ
This ladder mount is not cheap but it is very sturdy aluminum: https://www.amazon.com/gp/product/B01CQ06ZN2
A mast length of 20 feet has two advantages. First, it can be mounted low so you can extend it while standing safely on the ground. Second, once extended it goes a long way above the roof.
If you don’t have a ladder, something like this might be a possibility: https://www.amazon.com/Skywalker-Signature-Heavy-duty-Wall-Mount/dp/B009P73SMQ
Hope this helps