@@ -252,7 +252,7 @@ def read_vars_file(
252
252
vars_dir = Path (path ) / sub_dir
253
253
254
254
if is_dir :
255
- with open (path ) as f :
255
+ with open (path , "r" , encoding = "utf-8" ) as f :
256
256
for ext in VARS_FILENAME_EXTENSIONS :
257
257
if Path (f"{ path } { ext } " ).is_file ():
258
258
LOG .debug ("AnsibleInventory: reading var file %r" , path )
@@ -263,7 +263,7 @@ def read_vars_file(
263
263
for extension in VARS_FILENAME_EXTENSIONS :
264
264
vars_file = vars_file_base .with_suffix (vars_file_base .suffix + extension )
265
265
if vars_file .is_file ():
266
- with open (vars_file ) as f :
266
+ with open (vars_file , "r" , encoding = "utf-8" ) as f :
267
267
LOG .debug ("AnsibleInventory: reading var file %r" , vars_file )
268
268
return cast (Dict [str , Any ], YAML .load (f ))
269
269
LOG .debug (
@@ -406,7 +406,7 @@ def load_hosts_file(self) -> None:
406
406
class YAMLParser (AnsibleParser ):
407
407
def load_hosts_file (self ) -> None :
408
408
"""Parse host specific inventory files"""
409
- with open (self .hostsfile , "r" ) as f :
409
+ with open (self .hostsfile , "r" , encoding = "utf-8" ) as f :
410
410
self .original_data = cast (AnsibleGroupsDict , YAML .load (f ))
411
411
412
412
0 commit comments