Trying to install community. General unable to install facing error

I try every method except tarball file which i don’t no how to install in rhel9 … If there is any cmd fle that help me

First step I tried is
Ansible-galaxy collection install community. General
Error:
Process install dependency map
WARNING]: Skipping Galaxy server [link same as below] Got an unexpected error when getting available versions ofcollection community.general: Unknown error men attempting to call Galaxy at 'https//galaxy.ansible.com/api/: curlopen error [Errno 2) Name or service not knowm>. <urlopen error [Errno 2) Name or service

ot known> ROR! Unknown error when attempting to call sal curlepen error [Errno 21 Mane or service not known>, <urlopen error [Erine

Name or service not known

Second method: using requirement file
Requirements. Yml

Collections:
- name: community.general

Change in config file
[Server]
Server= https://galaxy.ansible.com/

Same error as above
Can someone help me with this?

Ansible-core 2.14.4

Name or service not known means that DNS doesn’t resolve for the hostname, which in this case is literally https//galaxy.ansible.com (note the lack of colon, :)

The Server= https://galaxy.ansible.com/ line probably should just be Server= galaxy.ansible.com

However, my config for ansible-core 2.16.9 looks more like this:

[galaxy]
server_list = galaxy

[galaxy_server.galaxy]
url = https://galaxy.ansible.com/api/

[root@c]ansible-galaxy collection install community.general

Starting galaxy collection install process

Process install dependency map

[WARNING]: Skipping Galaxy server https://galaxy.ansible.com. Got an unexpected error when getting available

versions of collection community.general: Unknown error when attempting to call Galaxy at ‘Api Root – Pulp 3’: <urlopen error [Errno -2] Name or service not known>. <urlopen error [Errno-2] Name or service

not known>

ERROR! Unknown error when attempting to call Galaxy at ‘Api Root – Pulp 3’: <urlopen error [Errno Name or service not known>. <urlopen error [Errno 2) Name or service not known>

[root@c~]# cd /etc/ansible; cat ansible.cfg

[defaults]

inventory /root/ip.txt

collections_path=/.root/ansible/collections

[galaxy]

server_list-galaxy

[galaxy_server.galaxy)

I

url=Api Root – Pulp 3
[root@c]# ansible-galaxy collection install -r requirements.yml

ERROR! The requirements file ‘/etc/ansible/requirements.yml’ does not exist.

[root@c ~]# ansible-galaxy collection install -r requirements.yml
Starting galaxy collection install process

Process install dependency map

[WARNING]: Skipping Galaxy server https://galaxy.ansible.com. Got an unexpected error when getting available

versions of collection community.general: Unknown error when attempting to call Galaxy at ‘Api Root – Pulp 3’: <urlopen error [Errno -2] Name or service not known>. <urlopen error [Errno-2] Name or service

not known>

ERROR! Unknown error when attempting to call Galaxy at ‘Api Root – Pulp 3’: <urlopen error [Errno Name or service not known>. <urlopen error [Errno 2) Name or service not known>

[root@c ~]# cat requirements.yml

collections:
- name: community.general

Hi @Denney-tech thanks for ur reply i had make changes has per ur instructions

Even than also getting same error

That looks like there’s a few typos…

[defaults]
inventory /root/ip.txt
collections_path=/.root/ansible/collections

[galaxy]
server_list = galaxy  # replaced '-' with '='

[galaxy_server.galaxy] # replaced ')' with ']'
# removed random 'I' character
url = https://galaxy.ansible.com/api/

That being said, since it still looks like a DNS issue (and the error output looks a little more sane), can you try testing with curl or nslookup?

curl https://galaxy.ansible.com/api/ and nslookup galaxy.ansible.com


On another note, can you upgrade ansible-core to a supported version? Your version predates the switch to new ansible galaxy, and may contain bugs relating to the api changes (not that that explains the Name resolution errors). Additionally, ansible-core <2.16 have reached end of life, and no longer receives any level of support.

2 Likes

Hii @Denney-tech thanks for help really appreciate your help actually i did same has u instructor it just i pasted here little bit wrong
Anyway i tried other method by downloading tar file for community. General it work for me…
Ansible Galaxy from here
And run

ansible-galaxy collection install community.genral .tar.file

Its work for me

Thanks for ur help :slight_smile:

1 Like

If downloading the tar files directly is satisfactory for you, that’s fine.

If you downloaded the tar from your ansible control node, then that should rule out DNS affecting ansible-galaxy. Upgrading ansible-core would have been my next suggestion. (also, you shouldn’t need to add galaxy.ansible.com to the ansible.cfg in the first place, since that’s the default… you would only need it if you were configuring multiple private galaxy/hub servers and still wanted to fail back to the public galaxy)

1 Like

How can i perform from ansible-core like what cmd and steps should i follow

Do you mean, how should you upgrade ansible-core? That’s a slightly complex question that I can’t give an exact answer to; partially because I have no idea what OS you have it installed on. I can give you some basic steps to follow though.

  1. Remove the version of ansible-core that you have by undoing whatever install process you used. If you used the system’s package manager, then it would be something like sudo yum/dnf/apt remove ansible-core, but if you used python’s pip installer it would be pip3 uninstall ansible-core. There’s also pipx which is a wrapper for pip that automatically installs packages into venvs, but it is fairly new and I doubt that’s how you’ve installed ansible. It would be similarly uninstalled though with pipx uninstall <venv-name>. If you installed the “batteries included” ansible package, this should get autoremoved when ansible-core is removed.

  2. Install a recent version of python (and pip). I recommend python 3.11, as there are some changes in >=3.12 that are breaking changes for a number of things (not just in Ansible, but the broader python community). sudo yum/dnf/apt install python3.11-pip

  3. Install ansible(-core) via pip from one of the options below. You don’t have to restrict the ansible-core version, but I wanted to add it as an example.
    a. pip3.11 install --user ansible-core # just core
    b. pip3.11 install --user ansible # "batteries included", includes ansible-core
    c. pip3.11 install --user ansible-core~=2.16.0 # restrict version to latest version of 2.16
    d. pip3.11 install --user ansible ansible-core~=2.16.0 # "batteries included" and restricts ansible-core dependency

  4. Upgrading ansible (for future reference) would simply be the same command you chose in step 3. with the --upgrade argument added.


Now that you’ve upgraded ansible-core to a more recent and supported version, you could try ansible-galaxy collection install --upgrade community.general to see if your original Name or service not known error has been resolved or not.

2 Likes