The community, or HOA, actually 'owns' the roof. Well, sort of anyways. The common area roof's are not really owned by the individual. Well, sorta. While a townhouse or condo is owned by the homeowner, the maintenance of roof is not. One of the reasons people like that option. Very little exterior care required.
However, don't expect it to be easy, or quite possibly impossible, to get Solar Panels on your shared roof.
Now, on a single family residence, but still governed by an HOA, that is a different story. They truly can't stop you from putting up Solar Panels on your home. You do have to get the dreaded architectural approval, they can request minimal changes, but they can't refuse them.
Most are pretty quickly approved. Maybe a color change, maybe an electrical box change. But, no disapproval, per California law.
So, considering Solar Panels? If you've got a community HOA, and live in a detached home, get the architectural approval. Go in with the knowledge they can't legally stop you, just a caveat or two possibly. But, you will get an 'You Can' approval from them. It's the law!