# Errors with ansible-galaxy and new galaxy.ansible.com token

**URL:** <https://forum.ansible.com/t/errors-with-ansible-galaxy-and-new-galaxy-ansible-com-token/1448>\
**Category:** Get Help\
**Tags:** token, galaxy-ng, ansible-core\
**Created:** [October 3, 2023, 9:17am UTC](https://forum.ansible.com/t/errors-with-ansible-galaxy-and-new-galaxy-ansible-com-token/1448 "2023-10-03T09:17:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![steadfasterX](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/steadfasterx/32/953_2.png) [@steadfasterX](https://forum.ansible.com/u/steadfasterX)\
**Post date:** [October 3, 2023, 9:17am UTC](https://forum.ansible.com/t/errors-with-ansible-galaxy-and-new-galaxy-ansible-com-token/1448/1 "2023-10-03T09:17:34Z")

</div>

same issue here, no AWX though! just ansible.

Running Ansible version **2.15.3**.

error:

`ansible-galaxy collection install --token <token> community.general -vvvvvvvvvvv`

> ERROR! Error when finding available api versions from release\_galaxy (xxxx://galaxy.ansible.com/) (HTTP Code: 403, Message: Forbidden)  
> ansible-galaxy [core 2.15.3]  
> config file = /home/xxxxx/.ansible.cfg  
> configured module search path = [‘/home/xxxxx/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]  
> ansible python module location = /usr/lib/python3.11/site-packages/ansible  
> ansible collection location = /opt/data/development/git/ansible\_collections:/home/xxxxx/.ansible/collections:/usr/share/ansible/collections  
> executable location = /usr/bin/ansible-galaxy  
> python version = 3.11.5 (main, Sep 2 2023, 14:16:33) [GCC 13.2.1 20230801] (/usr/bin/python)  
> jinja version = 3.1.2  
> libyaml = True  
> Using /home/xxxxx/.ansible.cfg as config file  
> Starting galaxy collection install process  
> Process install dependency map  
> Initial connection to galaxy\_server: xxxx://galaxy.ansible.com/  
> Created /home/xxxxx/.ansible/galaxy\_token  
> Calling Galaxy at xxxx://galaxy.ansible.com/api/

The file `/home/xxxxx/.ansible/galaxy_token` is created when not existing and is just empty. Nothing changes when I add this to that file (hope the format is correct):

`token: <token>`

The `<token>` has been taken from my NG galaxy profile page (while I see no reason to specify a token when _downloading_ public collections…)

on a second run the output is slightly different as it reads the token file now (which is either empty or filled manually - no it makes no diff in output if one or the other):

`ansible-galaxy collection install community.general -vvvvvvvvvvv`

> ERROR! Error when finding available api versions from release\_galaxy (xxxx://galaxy.ansible.com/) (HTTP Code: 403, Message: Forbidden)  
> ansible-galaxy [core 2.15.3]  
> config file = /home/xxxxx/.ansible.cfg  
> configured module search path = [‘/home/xxxxx/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]  
> ansible python module location = /usr/lib/python3.11/site-packages/ansible  
> ansible collection location = /opt/data/development/git/ansible\_collections:/home/xxxxx/.ansible/collections:/usr/share/ansible/collections  
> executable location = /usr/bin/ansible-galaxy  
> python version = 3.11.5 (main, Sep 2 2023, 14:16:33) [GCC 13.2.1 20230801] (/usr/bin/python)  
> jinja version = 3.1.2  
> libyaml = True  
> Using /home/xxxxx/.ansible.cfg as config file  
> Starting galaxy collection install process  
> Process install dependency map  
> Initial connection to galaxy\_server: [https://galaxy.ansible.com/](https://galaxy.ansible.com/)  
> Opened /home/xxxxx/.ansible/galaxy\_token  
> Calling Galaxy at xxxx://galaxy.ansible.com/api/

I also tried to downgrade/upgrade ansible-core to:

- v2.13.9 → same issue
- v2.14.1 → same issue
- v2.14.5 → same issue
- v2.15.4 → same issue
- v2.13.5 → python errors incl traceback (if interested I can paste it here but I dont think that matters for this issue here)
- 2.16.0b1 → same issue
- devel (from today, 2023-10-03) → same issue

As I can re-produce the issue on several older Ansible releases I do not think its related to ansible but more to the galaxy api…

---

<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:** [October 5, 2023, 4:10pm UTC](https://forum.ansible.com/t/errors-with-ansible-galaxy-and-new-galaxy-ansible-com-token/1448/2 "2023-10-05T16:10:00Z")

</div>

A post was merged into an existing topic: [AWX cannot download collections / roles from the new galaxy](https://forum.ansible.com/t/awx-cannot-download-collections-roles-from-the-new-galaxy/1251/5)

---

<div class="post-metadata">

**Author:** ![steadfasterX](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/steadfasterx/32/953_2.png) [@steadfasterX](https://forum.ansible.com/u/steadfasterX)\
**Post date:** [October 3, 2023, 12:12pm UTC](https://forum.ansible.com/t/errors-with-ansible-galaxy-and-new-galaxy-ansible-com-token/1448/3 "2023-10-03T12:12:47Z")

</div>

> [@AWX cannot download collections / roles from the new galaxy](http://forum.ansible.com/t/awx-cannot-download-collections-roles-from-the-new-galaxy/1251/5):
>
> On my macOS it worked with v2.15.4

unfortunately not for me (Manjaro Linux)

---

<div class="post-metadata">

**Author:** ![steadfasterX](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/steadfasterx/32/953_2.png) [@steadfasterX](https://forum.ansible.com/u/steadfasterX)\
**Post date:** [October 4, 2023, 8:55am UTC](https://forum.ansible.com/t/errors-with-ansible-galaxy-and-new-galaxy-ansible-com-token/1448/4 "2023-10-04T08:55:16Z")

</div>

so… after doing a lot of other tests I finally found the reason:

my `~/.ansible.cfg` contained a `token=<token>` line which I added for publishing a collection some time ago.

I out commented the token line and all starts working again.

before (not-working):

```auto
[galaxy]
server_list = release_galaxy

[galaxy_server.release_galaxy]
url=https://galaxy.ansible.com/api/
token=<not-NG-token>

```

after (working):

```auto
[galaxy]
server_list = release_galaxy

[galaxy_server.release_galaxy]
url=https://galaxy.ansible.com/api/
#token=<not-NG-token>

```

I assume putting in the new NG token would fix that as well. My assumption was always that using the CLI (e.g. `--token <token>`) would have precedence over whatever is set anywhere else but it seems not.

anyways it is solved for me now and maybe that helps someone else out there 🙂

---

<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:** [October 5, 2023, 3:31pm UTC](https://forum.ansible.com/t/errors-with-ansible-galaxy-and-new-galaxy-ansible-com-token/1448/5 "2023-10-05T15:31:14Z")

</div>

> [@steadfasterX](#):
>
> I assume putting in the new NG token would fix that as well. My assumption was always that using the CLI (e.g. `--token <token>`) would have precedence over whatever is set anywhere else but it seems not.

[Command-line options are supposed to override configuration files](https://docs.ansible.com/ansible/latest/reference_appendices/general_precedence.html#command-line-options).

This might be related to this [ansible-galaxy issue](https://github.com/ansible/ansible/issues/81698). It’s not exactly the same case, as that one is using an on-prem Galaxy NG deployment and uploading a collection, but you might want to comment or create a related issue.

Let’s add the Ansible [@Core](https://forum.ansible.com/groups/core) team here to see if they can shed some light or confirm on creating an issue about it. Also tagged with #ansible-core as this is related to the `ansible-galaxy` command

ps. Splitting the topic as this was unrelated to the parent.
