diff --git a/lib/ansible/modules/system/hostname.py b/lib/ansible/modules/system/hostname.py index 48311f07a96..95b28dbf69d 100755 --- a/lib/ansible/modules/system/hostname.py +++ b/lib/ansible/modules/system/hostname.py @@ -313,7 +313,7 @@ class OpenRCStrategy(GenericStrategy): def set_permanent_hostname(self, name): try: f = open(self.HOSTNAME_FILE, 'r') - lines = [x.strip() for x in f] + lines = (x.strip() for x in f) for i, line in enumerate(lines): if line.startswith('hostname='):