From 4fb5221b5fd888accc101d36cb99a49cd061f17c Mon Sep 17 00:00:00 2001 From: Andrea Scarpino Date: Fri, 21 Jul 2017 23:15:06 +0200 Subject: [PATCH] timezone: Assuming UTC when no /etc/localtime exists (#27131) --- lib/ansible/modules/system/timezone.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/system/timezone.py b/lib/ansible/modules/system/timezone.py index 353b245782..652fe93298 100644 --- a/lib/ansible/modules/system/timezone.py +++ b/lib/ansible/modules/system/timezone.py @@ -521,7 +521,8 @@ class BSDTimezone(Timezone): tz = os.readlink('/etc/localtime') return tz.replace('/usr/share/zoneinfo/', '') except: - self.module.fail_json(msg='Could not read /etc/localtime') + self.module.warn('Could not read /etc/localtime. Assuming UTC') + return 'UTC' else: self.module.fail_json(msg='{0} is not a supported option on target platform'. format(key))