diff --git a/lib/ansible/runner/connection_plugins/ssh.py b/lib/ansible/runner/connection_plugins/ssh.py index 876f2063848..2c2261194c8 100644 --- a/lib/ansible/runner/connection_plugins/ssh.py +++ b/lib/ansible/runner/connection_plugins/ssh.py @@ -207,9 +207,15 @@ class Connection(object): if not os.path.exists(hf): hfiles_not_found += 1 continue - host_fh = open(hf) - data = host_fh.read() - host_fh.close() + try: + host_fh = open(hf) + except IOError, e: + hfiles_not_found += 1 + continue + else + data = host_fh.read() + host_fh.close() + for line in data.split("\n"): if line is None or " " not in line: continue