Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Role Naming Conventions

Chris Houseknecht edited this page May 17, 2018 · 5 revisions

A traditional Ansible role is contained in a repository with a meta/main.yml file in the project root. When installing a role from a traditional role, the Galaxy CLI will use the following rules to set the role name on the target file system:

  • Use galaxy_info.role_name, if set in meta/main.yml.
  • When galaxy_info.role_name is not set, then start with the SCM repository name, and remove /^ansible-role[-+.]/, remove /^ansible[-+.]/, and remove /^role[-_+.]/

A multi-content repository does not contain a meta/main.yml file at the root level, and may contain different Ansible content types, including one or more Ansible roles. When installing a role from such a repository, the Galaxy CLI will use the following rules to set the role name on the target file system:

  • Use galaxy_info.role_name, if set in role_directory_name/meta/main.yml
  • When galaxy_info.role_name is not set, then start with the role's directory name , and remove /^ansible-role[-+.]/, remove /^ansible[-+.]/, and remove /^role[-_+.]/

From a Galaxy Resource

When installing content from a Galaxy resource, the Galaxy CLI will verify the content exists on the Galaxy server, and install it using the namespace name, repository name, and content name specified on the command line. Consequently, the values specified on the command line will match the values returned by the API.

It will not attempt to modify the content name by removing ansible-role-, nor ansible- from the repository name, nor from any installed role names.

From an SCM Resource

When installing content from an SCM+URL resource, the Galaxy CLI will use the SCM namespace, the repository name, and the content name found in the archive. The Galaxy CLI will either parse the URL, or interrogate the contents of the repository archive to determine the namespace and repository name values.

It will not attempt to locate the content on the Galaxy server. It will also not attempt to remove 'ansible-role', or ansible-' from the repository name, or from any installed role names.