# Ansible - errno 101 network is unreachable

**URL:** <https://forum.ansible.com/t/ansible-errno-101-network-is-unreachable/32471>\
**Category:** Ansible Project\
**Created:** [March 16, 2020, 4:07am UTC](https://forum.ansible.com/t/ansible-errno-101-network-is-unreachable/32471 "2020-03-16T04:07:36Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Santhosh\_Ganesan](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Santhosh\_Ganesan](https://forum.ansible.com/u/Santhosh_Ganesan)\
**Post date:** [March 16, 2020, 4:07am UTC](https://forum.ansible.com/t/ansible-errno-101-network-is-unreachable/32471/1 "2020-03-16T04:07:36Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [March 16, 2020, 7:25am UTC](https://forum.ansible.com/t/ansible-errno-101-network-is-unreachable/32471/2 "2020-03-16T07:25:38Z")

</div>

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’

---

<div class="post-metadata">

**Author:** ![Santhosh\_Ganesan](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Santhosh\_Ganesan](https://forum.ansible.com/u/Santhosh_Ganesan)\
**Post date:** [March 16, 2020, 9:50pm UTC](https://forum.ansible.com/t/ansible-errno-101-network-is-unreachable/32471/3 "2020-03-16T21:50:58Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![Santhosh\_Ganesan](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Santhosh\_Ganesan](https://forum.ansible.com/u/Santhosh_Ganesan)\
**Post date:** [March 16, 2020, 11:10pm UTC](https://forum.ansible.com/t/ansible-errno-101-network-is-unreachable/32471/4 "2020-03-16T23:10:36Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [March 17, 2020, 7:51am UTC](https://forum.ansible.com/t/ansible-errno-101-network-is-unreachable/32471/5 "2020-03-17T07:51:10Z")

</div>

Hii

---

<div class="post-metadata">

**Author:** ![Santhosh\_Ganesan](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Santhosh\_Ganesan](https://forum.ansible.com/u/Santhosh_Ganesan)\
**Post date:** [March 17, 2020, 9:18pm UTC](https://forum.ansible.com/t/ansible-errno-101-network-is-unreachable/32471/6 "2020-03-17T21:18:49Z")

</div>



---

<div class="post-metadata">

**Author:** ![Santhosh\_Ganesan](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Santhosh\_Ganesan](https://forum.ansible.com/u/Santhosh_Ganesan)\
**Post date:** [March 17, 2020, 9:51pm UTC](https://forum.ansible.com/t/ansible-errno-101-network-is-unreachable/32471/7 "2020-03-17T21:51:59Z")

</div>

followed few help from this link [https://access.redhat.com/discussions/4222851#comment-1751291](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”:

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [March 17, 2020, 10:25pm UTC](https://forum.ansible.com/t/ansible-errno-101-network-is-unreachable/32471/8 "2020-03-17T22:25:35Z")

</div>

I'm not going to waste more of my time by having information spoon fed  
like this.  
We're done.

---

<div class="post-metadata">

**Author:** ![Santhosh\_Ganesan](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Santhosh\_Ganesan](https://forum.ansible.com/u/Santhosh_Ganesan)\
**Post date:** [March 17, 2020, 11:20pm UTC](https://forum.ansible.com/t/ansible-errno-101-network-is-unreachable/32471/9 "2020-03-17T23:20:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nick\_Venenga](https://avatars.discourse-cdn.com/v4/letter/n/ac8455/32.png) [@Nick\_Venenga](https://forum.ansible.com/u/Nick_Venenga)\
**Post date:** [March 17, 2020, 11:31pm UTC](https://forum.ansible.com/t/ansible-errno-101-network-is-unreachable/32471/10 "2020-03-17T23:31:11Z")

</div>

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](https://unix.stackexchange.com/a/436562/249351)

---

<div class="post-metadata">

**Author:** ![Santhosh\_Ganesan](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Santhosh\_Ganesan](https://forum.ansible.com/u/Santhosh_Ganesan)\
**Post date:** [March 18, 2020, 4:47am UTC](https://forum.ansible.com/t/ansible-errno-101-network-is-unreachable/32471/11 "2020-03-18T04:47:55Z")

</div>

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  
`

---

<div class="post-metadata">

**Author:** ![Santhosh\_Ganesan](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Santhosh\_Ganesan](https://forum.ansible.com/u/Santhosh_Ganesan)\
**Post date:** [March 18, 2020, 4:53am UTC](https://forum.ansible.com/t/ansible-errno-101-network-is-unreachable/32471/12 "2020-03-18T04:53:43Z")

</div>

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,  
“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”:   
}

`
