Found this actually undocumented feature (at least I did not find the doc) with trial and error, extrapolating from the official doc
Add the desired name after the version.
ansible-galaxy role install git+git@site.net/ansible-myapp.git,master,myapp
This will install the role as myapp
using the specified version. For master
version, if this is the default repository branch, you can pass an empty version which will default to it:
ansible-galaxy role install git+git@site.net/ansible-myapp.git,,myapp
This was tested with:
$ ansible-galaxy --version
ansible-galaxy 2.9.10
config file = None
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
executable location = /usr/local/bin/ansible-galaxy
python version = 3.6.9 (default, Apr 18 2020, 01:56:04) [GCC 8.4.0]
NOTE: The TYPE positional argument role
in the above command line was introduced to differentiate roles and collections, and will default to role
if omitted (for compatibility with previous ansible galaxy versions)