Bootstrap FreeKB - Ansible - Resolve "ERROR! Error when finding available api versions from default (https://galaxy.ansible.com) (HTTP Code: 403, Message: Forbidden)"
Ansible - Resolve "ERROR! Error when finding available api versions from default (https://galaxy.ansible.com) (HTTP Code: 403, Message: Forbidden)"

Updated:   |  Ansible articles

Let's say something like this is being returned when attempting to install a collection.

~]$ ansible-galaxy collection install ansible.posix
Starting galaxy collection install process
Process install dependency map
ERROR! Error when finding available api versions from default (https://galaxy.ansible.com) (HTTP Code: 403, Message: Forbidden)

 

Notice this attempts to install the collection from galaxy.ansible.com. Ensure nslookup can resolve IP addresses.

~]$ nslookup galaxy.ansible.com
Server:         10.11.12.13
Address:        10.11.12.13#53

Non-authoritative answer:
Name:   galaxy.ansible.com
Address: 104.26.0.234
Name:   galaxy.ansible.com
Address: 104.26.1.234
Name:   galaxy.ansible.com
Address: 172.67.68.251
Name:   galaxy.ansible.com
Address: 2606:4700:20::681a:1ea
Name:   galaxy.ansible.com
Address: 2606:4700:20::ac43:44fb
Name:   galaxy.ansible.com
Address: 2606:4700:20::681a:ea

 

See if you can ping galaxy.ansible.com.

~]$ ping -c4 galaxy.ansible.com
PING galaxy.ansible.com (104.26.0.234) 56(84) bytes of data.
64 bytes from 104.26.0.234 (104.26.0.234): icmp_seq=1 ttl=59 time=9.73 ms
64 bytes from 104.26.0.234 (104.26.0.234): icmp_seq=2 ttl=59 time=12.4 ms
64 bytes from 104.26.0.234 (104.26.0.234): icmp_seq=3 ttl=59 time=10.8 ms
64 bytes from 104.26.0.234 (104.26.0.234): icmp_seq=4 ttl=59 time=12.8 ms

--- galaxy.ansible.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms

 

You may need to use or update a token. Log into https://galaxy.ansible.com, select Collections > API Access and Load Token. Then you can try to install the collection with the --token option.

ansible-galaxy collection install ansible.posix --token <your token>

 

You can can put the token in your /home/your_username/.ansible/galaxy_token file.

]$ cat /home/jeremy.canfield/.ansible/galaxy_token
token: <your token>

 

Or like this, in ansible.cfg.

[galaxy]
server_list = release_galaxy

[galaxy_server.release_galaxy]
url=https://galaxy.ansible.com/
token=<your token>

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 4dc865 in the box below so that we can be sure you are a human.