Yes, that's entirely possible. In this case, the posts pointing to the mountain must be concreted in a little deeper than the lower posts on the “valley side”.
Of course, this can reduce the usable height of the poles somewhat, which should be taken into account in advance when planning.
As a rule of thumb, a gradient of more than approx. 12 cm per meter should not be exceeded. It is then possible to determine the heights of the system well.
It is important that the system as a whole remains vertical and the gymnastics bars remain horizontal.