Ansible - errno 101 network is unreachable

1,109 views
Skip to first unread message

Santhosh Ganesan

unread,
Mar 16, 2020, 12:07:36 AM3/16/20
to Ansible Project
Newbie to ansible,

trying to run a playbook to one of host, 

</TASK [Gathering Facts] *********************************************************
ok: [172.28.158.115]

TASK [include_role : tes.kibana] ***********************************************

TASK [doe.kibana : Add Elasticsearch GPG key.] *********************************
fatal: [172.28.158.115]: FAILED! => {"changed": false, "msg": "failed to fetch key at https://artifacts.elastic.co/GPG-KEY-elasticsearch , error was: Request failed: <urlopen error [Errno 101] Network is unreachable>"}

PLAY RECAP *********************************************************************
172.28.158.115             : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0  >

Curl to the url works fine at host as well as at node
ssh host to node works fine

Unable to find a  clue for this error

pls help

Dick Visser

unread,
Mar 16, 2020, 3:26:10 AM3/16/20
to ansible...@googlegroups.com
Hi

Thanks for using ansible. To answer your question more information is
needed. Could you please describe clearly all of the below:

- Which commands did you run, and what actual output did you get
(copied as plain text - not as screenshots, images, or other binary
attachments).
- What do the relevant inventory/tasks/playbooks/code/variables look like.
- The output of ‘ansible --version’
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/8e17dbf5-1d2a-4ce0-8514-c7c8b94b522a%40googlegroups.com.



--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

Santhosh Ganesan

unread,
Mar 16, 2020, 5:51:29 PM3/16/20
to ansible...@googlegroups.com
Command : ansible-playbook elk-playbook.yml
Output:
PLAY [all] *********************************************************************


TASK [Gathering Facts] *********************************************************
ok: [172.28.158.115]

TASK [ping] ********************************************************************
ok: [172.28.158.115]

TASK [include_role : tes.elasticsearch] ****************************************

TASK [tes.elasticsearch : include_tasks] ***************************************
included: /root/.ansible/roles/tes.elasticsearch/tasks/setup-RedHat.yml for 172.28.158.115

TASK [tes.elasticsearch : Add Elasticsearch GPG key.] **************************

fatal: [172.28.158.115]: FAILED! => {"changed": false, "msg": "failed to fetch key at https://artifacts.elastic.co/GPG-KEY-elasticsearch , error was: Request failed: <urlopen error [Errno 101] Network is unreachable>"}

PLAY RECAP *********************************************************************
172.28.158.115             : ok=3    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0  

[root@localmain .ansible]#

elk-playbook has two tasks,
ping and include role tes.elasticsearch

ansible version :
[root@localmain .ansible]# ansible --version
ansible 2.9.3
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Nov 21 2019, 19:31:34) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]
[root@localmain .ansible]#

Curl to the key url works on localmain(control) as well as localhost1(node)
Checked the proxy too, included proxy var in /etc/profile.d/proxy.sh

what else i missed? am not aware



--
Cheers
Santhosh Ganesan

Santhosh Ganesan

unread,
Mar 16, 2020, 7:10:36 PM3/16/20
to Ansible Project
Found a way through setting up
my proxy under environment: in ansible playbook,

now facing this error

FAILED! => {"changed": false, "msg": "Failed to download packages: Cannot download 7.6.1/elasticsearch-7.6.1-x86_64.rpm: All mirrors were tried", "results": []}

any clue to this?

Dick Visser

unread,
Mar 17, 2020, 3:51:37 AM3/17/20
to ansible...@googlegroups.com
Hii

On Mon, 16 Mar 2020 at 22:51, Santhosh Ganesan <sne...@gmail.com> wrote:

> elk-playbook has two tasks,
> ping and include role tes.elasticsearch

This is still not enough information to work with.
Post the *actual* playbook - not a one line human interpretation of it.

Santhosh Ganesan

unread,
Mar 17, 2020, 5:19:15 PM3/17/20
to ansible...@googlegroups.com
---
- hosts: all
become: yes
tasks:
- ping:
- include_role:
name: doe.elasticsearch

I hope this helps
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.

Santhosh Ganesan

unread,
Mar 17, 2020, 5:51:59 PM3/17/20
to Ansible Project
followed few help from this link https://access.redhat.com/discussions/4222851#comment-1751291 like dnf upgrade -y --releasever=8

after that on first run of

ansible-playbook -vvv --flush-cache elk-playbook.yml

Escalation succeeded
<172.28.158.118> (1, b'\r\n{"msg": "Failed to download packages: Cannot download 7.6.1/elasticsearch-7.6.1-x86_64.rpm: All mirrors were tried", "results": [], "failed": true, "exception": "  File \\"/tmp/ansible_dnf_payload_mmu8acfl/ansible_dnf_payload.zip/ansible/modules/packaging/os/dnf.py\\", line 1179, in ensure\\n  File \\"/usr/lib/python3.6/site-packages/dnf/base.py\\", line 1159, in download_packages\\n    self._download_remote_payloads(payloads, drpm, progress, callback_total)\\n  File \\"/usr/lib/python3.6/site-packages/dnf/base.py\\", line 1089, in _download_remote_payloads\\n    raise dnf.exceptions.DownloadError(errors._irrecoverable)\\n", "invocation": {"module_args": {"name": ["elasticsearch"], "state": "present", "allow_downgrade": false, "autoremove": false, "bugfix": false, "disable_gpg_check": false, "disable_plugin": [], "disablerepo": [], "download_only": false, "enable_plugin": [], "enablerepo": [], "exclude": [], "installroot": "/", "install_repoquery": true, "install_weak_deps": true, "security": false, "skip_broken": false, "update_cache": false, "update_only": false, "validate_certs": true, "lock_timeout": 30, "conf_file": null, "disable_excludes": null, "download_dir": null, "list": null, "releasever": null}}}\r\n', b'Shared connection to 172.28.158.118 closed.\r\n')
<172.28.158.118> Failed to connect to the host via ssh: Shared connection to 172.28.158.118 closed.
<172.28.158.118> ESTABLISH SSH CONNECTION FOR USER: None
<172.28.158.118> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/9f99d47bcf 172.28.158.118 '/bin/sh -c '"'"'rm -f -r /root/.ansible/tmp/ansible-tmp-1584481655.4368277-75248524508419/ > /dev/null 2>&1 && sleep 0'"'"''
<172.28.158.118> (0, b'', b'')
The full traceback is:
  File "/tmp/ansible_dnf_payload_mmu8acfl/ansible_dnf_payload.zip/ansible/modules/packaging/os/dnf.py", line 1179, in ensure
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 1159, in download_packages
    self._download_remote_payloads(payloads, drpm, progress, callback_total)
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 1089, in _download_remote_payloads
    raise dnf.exceptions.DownloadError(errors._irrecoverable)

fatal: [172.28.158.118]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "allow_downgrade": false,
            "autoremove": false,
            "bugfix": false,
            "conf_file": null,
            "disable_excludes": null,
            "disable_gpg_check": false,
            "disable_plugin": [],
            "disablerepo": [],
            "download_dir": null,
            "download_only": false,
            "enable_plugin": [],
            "enablerepo": [],
            "exclude": [],
            "install_repoquery": true,
            "install_weak_deps": true,
            "installroot": "/",
            "list": null,
            "lock_timeout": 30,
            "name": [
                "elasticsearch"
            ],
            "releasever": null,
            "security": false,
            "skip_broken": false,
            "state": "present",
            "update_cache": false,
            "update_only": false,
            "validate_certs": true
        }
    },

    "msg": "Failed to download packages: Cannot download 7.6.1/elasticsearch-7.6.1-x86_64.rpm: All mirrors were tried",
    "results": []

On Wednesday, March 18, 2020 at 8:19:15 AM UTC+11, Santhosh Ganesan wrote:
---
- hosts: all
become: yes
tasks:
- ping:
- include_role:
name: doe.elasticsearch

I hope this helps
On Tue, Mar 17, 2020 at 6:51 PM Dick Visser <dick....@geant.org> wrote:
Hii

On Mon, 16 Mar 2020 at 22:51, Santhosh Ganesan <sne...@gmail.com> wrote:

> elk-playbook has two tasks,
> ping and include role tes.elasticsearch

This is still not enough information to work with.
Post the *actual* playbook - not a one line human interpretation of it.


--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.


--
Cheers
Santhosh Ganesan

Dick Visser

unread,
Mar 17, 2020, 6:26:06 PM3/17/20
to ansible...@googlegroups.com
I'm not going to waste more of my time by having information spoon fed
like this.
We're done.
>>> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAL8fbwNunyuWHoqK4mYcczUDHGbZf%2BsLm-PumZ%3DExWmJvPairA%40mail.gmail.com.
>>
>>
>>
>> --
>> Cheers
>> Santhosh Ganesan
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/c89a3520-79be-4d84-ae78-506190397035%40googlegroups.com.

Santhosh Ganesan

unread,
Mar 17, 2020, 7:20:54 PM3/17/20
to Ansible Project
anyhow newbie communication makes bad,

tried setting up a new vm tried a fresh ansible-playbook run on the vm,  still getting the same error

dunno where it falls
>>> To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAL8fbwNunyuWHoqK4mYcczUDHGbZf%2BsLm-PumZ%3DExWmJvPairA%40mail.gmail.com.
>>
>>
>>
>> --
>> Cheers
>> Santhosh Ganesan
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.

Nick Venenga

unread,
Mar 17, 2020, 7:31:11 PM3/17/20
to Ansible Project
It sounds like you require a network proxy but haven't configured dnf to use it correctly. See https://unix.stackexchange.com/a/436562/249351

Santhosh Ganesan

unread,
Mar 18, 2020, 12:47:55 AM3/18/20
to Ansible Project

Hi Nick,

I did add the proxy to the vars in elk-playbook.yml ,

Accessing through ansible only fails
 
The below is my ansible section, where am doing the test
---
- include_tasks: setup-RedHat.yml
 when: ansible_os_family == 'RedHat'

- include_tasks: setup-Debian.yml
 when: ansible_os_family == 'Debian'

- name: execute curl
 get_url:
   dest: /root/

- name: Install Elasticsearch.
 become: true
 package:
   name: elasticsearch
   state: "{{ elasticsearch_package_state }}"
 retries: 5
 delay: 2
 register: elasticsearch_result
 until: elasticsearch_result is succeeded
In the /var/log/dnf.log
i could see that it failed to download the mentioned URL

but when i used seperately as get_url option it did work

dunno where it fails again :(

Santhosh Ganesan

unread,
Mar 18, 2020, 12:53:43 AM3/18/20
to Ansible Project
The actual ansible error is

<172.28.158.115> (1, b'\r\n{"msg": "Failed to download packages: Cannot download 7.6.1/elasticsearch-7.6.1-x86_64.rpm: All mirrors were tried", "results": [], "failed": true, "exception": "  File \\"/tmp/ansible_dnf_payload_w1z9yyx7/ansible_dnf_payload.zip/ansible/modules/packaging/os/dnf.py\\", line 1179, in ensure\\n  File \\"/usr/lib/python3.6/site-packages/dnf/base.py\\", line 1149, in download_packages\\n    self._download_remote_payloads(payloads, drpm, progress, callback_total)\\n  File \\"/usr/lib/python3.6/site-packages/dnf/base.py\\", line 1079, in _download_remote_payloads\\n    raise dnf.exceptions.DownloadError(errors._irrecoverable)\\n", "invocation": {"module_args": {"name": ["elasticsearch"], "state": "present", "allow_downgrade": false, "autoremove": false, "bugfix": false, "disable_gpg_check": false, "disable_plugin": [], "disablerepo": [], "download_only": false, "enable_plugin": [], "enablerepo": [], "exclude": [], "installroot": "/", "install_repoquery": true, "install_weak_deps": true, "security": false, "skip_broken": false, "update_cache": false, "update_only": false, "validate_certs": true, "lock_timeout": 30, "conf_file": null, "disable_excludes": null, "download_dir": null, "list": null, "releasever": null}}}\r\n', b'Shared connection to 172.28.158.115 closed.\r\n')
<172.28.158.115> Failed to connect to the host via ssh: Shared connection to 172.28.158.115 closed.
<172.28.158.115> ESTABLISH SSH CONNECTION FOR USER: None
<172.28.158.115> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/3242a7d1b4 172.28.158.115 '/bin/sh -c '"'"'rm -f -r /root/.ansible/tmp/ansible-tmp-1584506598.4608717-56350147288873/ > /dev/null 2>&1 && sleep 0'"'"''
<172.28.158.115> (0, b'', b'')
The full traceback is:
  File "/tmp/ansible_dnf_payload_w1z9yyx7/ansible_dnf_payload.zip/ansible/modules/packaging/os/dnf.py", line 1179, in ensure
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 1149, in download_packages
    self._download_remote_payloads(payloads, drpm, progress, callback_total)
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 1079, in _download_remote_payloads
    raise dnf.exceptions.DownloadError(errors._irrecoverable)

fatal: [172.28.158.115]: FAILED! => {
    "attempts": 5,
Reply all
Reply to author
Forward
0 new messages