@misc mentioned this Gitea ansible role that may do the right thing.
https://testgit.home.ephaone.org/misc/ansible-role-gitea