diff --git a/changelogs/fragments/74488_solaris_looseversion.yml b/changelogs/fragments/74488_solaris_looseversion.yml new file mode 100644 index 00000000000..82eb6501974 --- /dev/null +++ b/changelogs/fragments/74488_solaris_looseversion.yml @@ -0,0 +1,2 @@ +bugfixes: +- service - compare version without LooseVersion API (https://github.com/ansible/ansible/issues/74488). diff --git a/lib/ansible/modules/service.py b/lib/ansible/modules/service.py index f4eb709735d..3a0953a43f7 100644 --- a/lib/ansible/modules/service.py +++ b/lib/ansible/modules/service.py @@ -1356,8 +1356,8 @@ class SunOSService(Service): # Support for synchronous restart/refresh is only supported on # Oracle Solaris >= 11.2 for line in open('/etc/release', 'r').readlines(): - m = re.match(r'\s+Oracle Solaris (\d+\.\d+).*', line.rstrip()) - if m and m.groups()[0] >= 11.2: + m = re.match(r'\s+Oracle Solaris (\d+)\.(\d+).*', line.rstrip()) + if m and m.groups() >= ('11', '2'): return True def get_service_status(self):