You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are some roles defined in tdp-collection-extras that I cannot import because they all have the same error :
- hosts: allbecome: yestasks:
- name: Common setup and configuration accross all ansible hostsimport_role:
name: tosit.tdp_extra.ansible-tdp-common-actions# leads to :ERROR! the role 'ansible_roles/collections/ansible_collections/tosit/tdp_extra/roles/ansible-tdp-common-actions' was not found in [list of my ansible paths]
the cause
Roles names in collections must not contain dashes (-).
Here are some references from the latest Ansible documentation.
Role names are now limited to contain only lowercase alphanumeric characters, plus _ and start with an alpha character.
The directory name of the role is used as the role name. Therefore, the directory name must comply with the above role name rules. The collection import into Galaxy will fail if a role name does not comply with these rules.
In this example we have a standalone role called my-standalone-role.webapp to emulate a standalone role that contains dashes in the name (which is not valid in collections)
The dash - character is not valid for playbook names in collections.
the solution
Replace all dashes (-) with underscores (_) in roles names.
For example the folder ./roles/ansible-tdp-common-actions would be renamed ./roles/ansible_tdp_common_actions.
I tried this already and it works. With that minor needed update, tdp-collection-extras could be used as a functionning collection installed via ansible-galaxy.
The text was updated successfully, but these errors were encountered:
the situation
I chose to install all tdp collections with ansible-galaxy (I'm using Ansible 2.11.11), as dependencies, which works fine.
In most cases I can import playbook from a collection with its FQCN name like this :
And a role like this :
Or a specific task like this :
the problem
There are some roles defined in tdp-collection-extras that I cannot import because they all have the same error :
the cause
Roles names in collections must not contain dashes (
-
).Here are some references from the latest Ansible documentation.
the solution
Replace all dashes (
-
) with underscores (_
) in roles names.For example the folder ./roles/ansible-tdp-common-actions would be renamed ./roles/ansible_tdp_common_actions.
I tried this already and it works. With that minor needed update, tdp-collection-extras could be used as a functionning collection installed via ansible-galaxy.
The text was updated successfully, but these errors were encountered: