From c0886a5f3ad2e760ea72cd8499180ee8525c59be Mon Sep 17 00:00:00 2001 From: Herby Gillot Date: Sun, 23 Mar 2014 21:59:47 -0400 Subject: [PATCH 1/2] Add a fact providing the full hostname, without the domain portion truncated. --- lib/ansible/module_utils/facts.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index 01f812def7b..dd6d76ff63d 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -108,6 +108,7 @@ class Facts(object): self.facts['python_version'] = platform.python_version() self.facts['fqdn'] = socket.getfqdn() self.facts['hostname'] = platform.node().split('.')[0] + self.facts['full_hostname'] = platform.node() self.facts['domain'] = '.'.join(self.facts['fqdn'].split('.')[1:]) arch_bits = platform.architecture()[0] self.facts['userspace_bits'] = arch_bits.replace('bit', '') From 94297950a0d55c5007dd65dd4ac556d530ba5828 Mon Sep 17 00:00:00 2001 From: Herby Gillot Date: Tue, 25 Mar 2014 11:20:19 -0400 Subject: [PATCH 2/2] Name platform.node() fact as "nodename" --- lib/ansible/module_utils/facts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index dd6d76ff63d..3eaac69ccaf 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -108,7 +108,7 @@ class Facts(object): self.facts['python_version'] = platform.python_version() self.facts['fqdn'] = socket.getfqdn() self.facts['hostname'] = platform.node().split('.')[0] - self.facts['full_hostname'] = platform.node() + self.facts['nodename'] = platform.node() self.facts['domain'] = '.'.join(self.facts['fqdn'].split('.')[1:]) arch_bits = platform.architecture()[0] self.facts['userspace_bits'] = arch_bits.replace('bit', '')