I'm trying to update my role so it works with ansible-lint 5.x, and that version requires standalone roles to have a valid role_name in the meta/main.yml file.
So I added that value to my php-versions role (which _was_ here: https://galaxy.ansible.com/geerlingguy/php-versions), and imported it on Galaxy.
I saw in the import task output:
Updating repository name "php-versions" -> "php_versions"
And indeed, the role has vanished from the old URL and is not installable when requiring geerlingguy.php-versions anymore.
I guess I'll have to figure out some workaround to get ansible-lint working, but in the mean time, do you know if the ability to set a role_name in the meta/main.yml file and it not blow out the old name be fixed, or should I just not use that feature and try to work with the ansible-lint maintainer to figure out some other way of supporting standalone Galaxy roles?
The role has a quarter-million downloads and is used by thousands of developers in the PHP ecosystem... I really don't want to break their workflows for too long.
The role should not change names replacing dashes with underscores.
The old role is wiped out and moved to an entirely new name, and ansible-galaxy installs for the old role name completely fail (without even a redirect to the new role name).
@geerlingguy @awcrosby is working on a fix for this today.
If a user imports a new standalone role, we want to enforce the usage of underscores not dashes in the role name, so it is easier to move that role to a collection. We also want to support a user’s ability to change a role name by setting the meta/main.yml role_name https://galaxy.ansible.com/docs/contributing/importing.html#role-name-limitations:
To override the default name for an Ansible role, set the role_name attribute in the role meta/main.yml file
But for this particular issue… we shouldn’t break existing roles. So we are planning to add a new logic check to prevent this for existing roles.
Regarding ansible-lint requiring the meta/main.yml role_name, we may want to reconsider that since we state in docs to set it to override the default role name.
@awcrosby - Thank you! That would be a huge help, and for ansible-lint, the main difficulty was that unlike with collections, roles don't have any _required_ metadata which could make ansible-lint know what the role's namespace + name should be, so the compromise was to try to use the author + role_name from meta/main.yml. That's not a perfect solution but may help a number of existing role authors (like me ;) who have one of the tens of thousands of roles still maintained on Galaxy today.
@geerlingguy a database change has updated "php_versions" -> "php-versions" - so the page and installs should function. We'll let you know when it is safe to import again with the meta/main.yml role_name present.
Re-opening this until fix is deployed to production
@geerlingguy this fix has been deployed to production, I kicked off an import of php-versions and it was happy with the role_name being set
@awcrosby - Woohoo, thanks! I'll test it out on another role too :)
Edit: Worked!
Most helpful comment
@geerlingguy this fix has been deployed to production, I kicked off an import of
php-versionsand it was happy with therole_namebeing set