1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
This commit is contained in:
Ruggero Marchei 2014-07-14 22:51:40 +02:00
parent 7c6175e780
commit d6bca15aa5

View file

@ -39,6 +39,8 @@ EXAMPLES = '''
- hostname: name=web01 - hostname: name=web01
''' '''
from distutils.version import LooseVersion
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
@ -297,7 +299,7 @@ class RedHat5Hostname(Hostname):
class RedHatServerHostname(Hostname): class RedHatServerHostname(Hostname):
platform = 'Linux' platform = 'Linux'
distribution = 'Red hat enterprise linux server' distribution = 'Red hat enterprise linux server'
if float(get_distribution_version()) >= 7: if LooseVersion(get_distribution_version()) >= LooseVersion("7"):
strategy_class = FedoraStrategy strategy_class = FedoraStrategy
else: else:
strategy_class = RedHatStrategy strategy_class = RedHatStrategy
@ -305,7 +307,7 @@ class RedHatServerHostname(Hostname):
class RedHatWorkstationHostname(Hostname): class RedHatWorkstationHostname(Hostname):
platform = 'Linux' platform = 'Linux'
distribution = 'Red hat enterprise linux workstation' distribution = 'Red hat enterprise linux workstation'
if float(get_distribution_version()) >= 7: if LooseVersion(get_distribution_version()) >= LooseVersion("7"):
strategy_class = FedoraStrategy strategy_class = FedoraStrategy
else: else:
strategy_class = RedHatStrategy strategy_class = RedHatStrategy
@ -313,18 +315,22 @@ class RedHatWorkstationHostname(Hostname):
class CentOSHostname(Hostname): class CentOSHostname(Hostname):
platform = 'Linux' platform = 'Linux'
distribution = 'Centos' distribution = 'Centos'
if float(get_distribution_version()) >= 7: strategy_class = RedHatStrategy
class CentOSLinuxHostname(Hostname):
platform = 'Linux'
distribution = 'Centos linux'
strategy_class = FedoraStrategy strategy_class = FedoraStrategy
else:
class ScientificHostname(Hostname):
platform = 'Linux'
distribution = 'Scientific'
strategy_class = RedHatStrategy strategy_class = RedHatStrategy
class ScientificLinuxHostname(Hostname): class ScientificLinuxHostname(Hostname):
platform = 'Linux' platform = 'Linux'
distribution = 'Scientific' distribution = 'Scientific linux'
if float(get_distribution_version()) >= 7:
strategy_class = FedoraStrategy strategy_class = FedoraStrategy
else:
strategy_class = RedHatStrategy
class AmazonLinuxHostname(Hostname): class AmazonLinuxHostname(Hostname):
platform = 'Linux' platform = 'Linux'