From 96a20de9ff37bc2fdd5dae30a8f818836fddaa17 Mon Sep 17 00:00:00 2001 From: Ben Konrath Date: Tue, 20 Jan 2015 21:50:15 +0100 Subject: [PATCH] Add support for SL7 to hostname module. --- lib/ansible/modules/system/hostname.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/system/hostname.py b/lib/ansible/modules/system/hostname.py index 2ca7479829b..f645a8cdfd3 100644 --- a/lib/ansible/modules/system/hostname.py +++ b/lib/ansible/modules/system/hostname.py @@ -380,12 +380,20 @@ class CentOSLinuxHostname(Hostname): class ScientificHostname(Hostname): platform = 'Linux' distribution = 'Scientific' - strategy_class = RedHatStrategy + distribution_version = get_distribution_version() + if distribution_version and LooseVersion(distribution_version) >= LooseVersion("7"): + strategy_class = SystemdStrategy + else: + strategy_class = RedHatStrategy class ScientificLinuxHostname(Hostname): platform = 'Linux' distribution = 'Scientific linux' - strategy_class = RedHatStrategy + distribution_version = get_distribution_version() + if distribution_version and LooseVersion(distribution_version) >= LooseVersion("7"): + strategy_class = SystemdStrategy + else: + strategy_class = RedHatStrategy class AmazonLinuxHostname(Hostname): platform = 'Linux'