I've started this little project of my own, to create a python script that will connect to Linux servers via SSH and will run commands on them. 
This was successful, but when I attempted to use a list of IPs from a file, I ran into the problem where it will only connect to one of the IPs (just one line) in the file. The file contains the following entries : 

172.18.8.130

172.18.8.137

And the problem is that the script only returns output from the second IP: 

['Linux 172.18.8.137 4.18.0-147.5.1.el8\_1.x86\_64 #1 SMP Wed Feb 5 02:00:39 UTC 2020 x86\_64 x86\_64 x86\_64 GNU/Linux\n']

The code is 

```
import paramiko

ssh = paramiko.SSHClient()

ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())

with open(r'D:\servers.txt', 'r') as fp:
    for line in fp:
     line = (fp.read())

ssh.connect(line, 22, "root", "password")

stdin, stdout, stderr = ssh.exec_command("uname -a")

print (stdout.readlines())

```

How can I make it to go through all of the lines (IPs) in that file, so it will connect and run uname -a on all of the servers ?