Ansible - Resolve "urlopen error timed out"

Let's say the following is being returned when attempting to read a file on a remote system using the uri module or downloading a file on a remote system using the get_url module.

urlopen error timed out

 

Ansible is kind of interesting in that an SSH connection is made from the Ansible control node (that's your Ansible server) to the managed node (e.g. target server), and then a Python command is issued to read or download a file from the remote system to the managed node.

Before spending all sorts of time trying to determine if there is some issue on the Ansible side, it make much more sense to first determine if the managed node is able to read or download files from a remote system. If the managed node is a Linux system, the curl command can be used to see if you are able to read a file on a remote system. 

[john.doe@server1 ~]# curl --url http://www.example.com/foo.txt
curl: (7) Failed connect to www.example.com:80; Connection timed out

 

Similarly, the wget command can used to see if you are able to download a file from a remote system.

[john.doe@server1 ~]# wget https://www.example.com/foo.txt
--2021-08-12 06:16:15--  https://www.example.com/foo.txt
Resolving www.example.com (www.example.com)... 93.184.216.34
Connecting to www.example.com (www.example.com)|93.184.216.34|:80... failed: Connection timed out.

 

Notice in these examples that "connection timed out" is returned, which suggests some issue on server1 in this example.



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.





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




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |