diff --git a/lib/ansible/template/__init__.py b/lib/ansible/template/__init__.py index 6c7ef82899..162f41c483 100644 --- a/lib/ansible/template/__init__.py +++ b/lib/ansible/template/__init__.py @@ -86,7 +86,7 @@ def generate_ansible_template_vars(path): b_path = to_bytes(path) try: template_uid = pwd.getpwuid(os.stat(b_path).st_uid).pw_name - except: + except (KeyError, TypeError): template_uid = os.stat(b_path).st_uid temp_vars = {}