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 c92b2a97be1..056183be05c 100644 --- a/lib/ansible/modules/service.py +++ b/lib/ansible/modules/service.py @@ -1355,8 +1355,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 LooseVersion(m.groups()[0]) >= LooseVersion('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):