# Lost all history of ansible role after delete of a another role

**URL:** <https://forum.ansible.com/t/lost-all-history-of-ansible-role-after-delete-of-a-another-role/1753>\
**Category:** Get Help\
**Tags:** galaxy-ng\
**Created:** [October 17, 2023, 3:03pm UTC](https://forum.ansible.com/t/lost-all-history-of-ansible-role-after-delete-of-a-another-role/1753 "2023-10-17T15:03:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![riemers](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/riemers/32/1203_2.png) [@riemers](https://forum.ansible.com/u/riemers)\
**Post date:** [October 17, 2023, 3:03pm UTC](https://forum.ansible.com/t/lost-all-history-of-ansible-role-after-delete-of-a-another-role/1753/1 "2023-10-17T15:03:28Z")

</div>

So i have the role riemers.gitlab-runner. It had almost 1 mil downloads, so was pretty proud about that. Now bump into this whole galaxy update that is just a pain to begin with.

I tried to use the cli, documentation is beyond bad since all over the place it still refers to old ansible-galaxy methods (i can understand it takes time to find all)

Long story short, i did a import of my role to get a new version out the door but my github repo name is sligthly different then the role name. So github has ansible-gitlab-runner as name, role is gitlab-runner. So by mistake i had now 2 roles. 1 with the latest version and 1 with the old versions and proper downloads.

So yeah, i thought lets just remove the wrong role by deleting it. So i said `ansible-galaxy delete riemers ansible-gitlab-runner` because i wanted to get rid of that role. And after that it deleted BOTH roles. Including my old one.

I did an import after that which now has 1 update, no version history and no downloads showing at all anymore.

Can anyone pretty please do some magic to revert this or import it from the old galaxy so i can then update it with the proper command? Not to mention people might actually use it and it breaks if they are pinned on a certain version ;(

---

<div class="post-metadata">

**Author:** ![riemers](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/riemers/32/1203_2.png) [@riemers](https://forum.ansible.com/u/riemers)\
**Post date:** [October 19, 2023, 7:41am UTC](https://forum.ansible.com/t/lost-all-history-of-ansible-role-after-delete-of-a-another-role/1753/2 "2023-10-19T07:41:15Z")

</div>

![image](https://us1.discourse-cdn.com/ansible/optimized/2X/1/1d5a5830f49f06df2c3c4fbe10b857d1e8fc48dc_2_690x60.png)

Just to show, this was my last command yet it still added `ansible` in front of it so now nobody can find the role anymore either. ☹

---

<div class="post-metadata">

**Author:** ![Leo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/leo/32/23_2.png) [@Leo](https://forum.ansible.com/u/Leo)\
**Post date:** [November 23, 2023, 1:24am UTC](https://forum.ansible.com/t/lost-all-history-of-ansible-role-after-delete-of-a-another-role/1753/3 "2023-11-23T01:24:23Z")

</div>

> [@riemers](#):
>
> Can anyone pretty please do some magic to revert this or import it from the old galaxy so i can then update it with the proper command? Not to mention people might actually use it and it breaks if they are pinned on a certain version ;(

Hello @riemers , thanks for your report. Let’s see if the [@galaxy](https://forum.ansible.com/groups/galaxy) team can help with your request for a rollback or restore.

> [@riemers](#):
>
> So yeah, i thought lets just remove the wrong role by deleting it. So i said `ansible-galaxy delete riemers ansible-gitlab-runner` because i wanted to get rid of that role. And after that it deleted BOTH roles. Including my old one.

Regarding the issue with `ansible-galaxy delete` deleting both roles, that seems weird and might be a bug, although I notice you used the namespace for the old role in that line. Was that the exact command that caused the issue?

I will try to replicate that and see what I come up with. If that’s an issue, the `ansible-galaxy` command line tool is independent from “Ansible Galaxy the Web Interface” and is managed by the ansible-core team, so we would need to split both issues.

> [@riemers](#):
>
> I tried to use the cli, documentation is beyond bad since all over the place it still refers to old ansible-galaxy methods (i can understand it takes time to find all)

About the docs, please report the outdated docs you find to help the community and the [@Docs](https://forum.ansible.com/groups/docs) Working Group fix them. If you have any bookmarked, we would appreciate you provide references here.

You can even submit a PR to update something you noticed if you want to contribute directly. As you said, sometimes updating everything everywhere is hard.

Again, thanks for your reports and your contribution to the collection ecosystem!

---

<div class="post-metadata">

**Author:** ![riemers](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/riemers/32/1203_2.png) [@riemers](https://forum.ansible.com/u/riemers)\
**Post date:** [January 8, 2024, 7:53am UTC](https://forum.ansible.com/t/lost-all-history-of-ansible-role-after-delete-of-a-another-role/1753/4 "2024-01-08T07:53:16Z")

</div>

And as always, it is the community that does the work. I think the whole galaxy exist because of community members. The whole fact that there is 0 communications from anyone from the galaxy team is just really really bad.

At this point i am throwing in the towel. After having 1 mil downloads with a role i would say i did my best to support the community with something. I feel sad that it has come this way. I don’t work for ansible galaxy, i don’t get payed for it and i certainly don’t intend to spend my time to fix/work on stuff that someone broke there.

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [January 9, 2024, 4:21pm UTC](https://forum.ansible.com/t/lost-all-history-of-ansible-role-after-delete-of-a-another-role/1753/5 "2024-01-09T16:21:02Z")

</div>

This is another thread that got lost among all the other ones, apologies for that.

I’ve corrected the roles mentioned via the following steps:

1. `ansible-galaxy role import --role-name=gitlab-runner riemers ansible-gitlab-runner` … this brought the `riemers.gitlab-runner` role back into the system with all of it’s versions.
2. In the database, I set the download count for the role to 982975 based on the value in old-galaxy.
3. Deleted the bad role via curl … `curl -X DELETE -H 'Authorization: token MYTOKEN' https://galaxy.ansible.com/api/v1/roles/37080/`

I think that leaves us in the state you asked for in this post …

[https://galaxy.ansible.com/ui/standalone/roles/riemers/gitlab-runner/versions/](https://galaxy.ansible.com/ui/standalone/roles/riemers/gitlab-runner/versions/)

 ![image](https://us1.discourse-cdn.com/ansible/original/2X/4/44208cca44b612bc3d4482a4039fa54c0557b77a.png)

Things to keep in mind …

We’ve revamped the backend import code to allow the --role-name parameter to work correctly AND for you to be able to set the value for the name and the namespace in meta/main.yml

> [@Ansible Galaxy’s role import enhancements and fixes for the new year](http://forum.ansible.com/t/ansible-galaxy-s-role-import-enhancements-and-fixes-for-the-new-year/3206):
>
> Ansible Galaxy’s role import enhancements and fixes for the new year. Import logging … Remember when you could see a nice formatted list of messages when your roles were imported? We’ve brought that back (see [Role import logging by jctanner · Pull Request #1959 · ansible/galaxy\_ng · GitHub](https://github.com/ansible/galaxy_ng/pull/1959))! You may have already noticed, but when you run “ansible-galaxy role import” it displays colorized messages about what the backend is doing with the role (where it’s cloning from, what lint tests pass or fa…

In this case, you should always pass `--role-name=gitlab-runner` for your imports.

---

<div class="post-metadata">

**Author:** ![riemers](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/riemers/32/1203_2.png) [@riemers](https://forum.ansible.com/u/riemers)\
**Post date:** [January 22, 2024, 7:40am UTC](https://forum.ansible.com/t/lost-all-history-of-ansible-role-after-delete-of-a-another-role/1753/6 "2024-01-22T07:40:54Z")

</div>

Well this is a nice surprise, although as you say your self covered/lost in the big pile. Now i need to do some catch-up 🍅

Also good to read that there was indeed an issue and i should use the role to pass along on the import.
