aruba: use the hostname, not the FQDN
This commit is contained in:
parent
1d4534f19c
commit
89d22feba1
2 changed files with 7 additions and 1 deletions
|
@ -8,6 +8,7 @@ class FilterModule:
|
||||||
def filters(self):
|
def filters(self):
|
||||||
return {
|
return {
|
||||||
"remove_domain_suffix": remove_domain_suffix,
|
"remove_domain_suffix": remove_domain_suffix,
|
||||||
|
"hostname": hostname,
|
||||||
"ipaddr_sort": ipaddr_sort,
|
"ipaddr_sort": ipaddr_sort,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +18,11 @@ def remove_domain_suffix(name):
|
||||||
return parent.to_text()
|
return parent.to_text()
|
||||||
|
|
||||||
|
|
||||||
|
def hostname(fqdn):
|
||||||
|
name = dns.name.from_text(fqdn)
|
||||||
|
return name.relativize(name.parent()).to_text()
|
||||||
|
|
||||||
|
|
||||||
def ipaddr_sort(addrs, types, unknown_after=True):
|
def ipaddr_sort(addrs, types, unknown_after=True):
|
||||||
check_types = {
|
check_types = {
|
||||||
"global": attrgetter("is_global"),
|
"global": attrgetter("is_global"),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{{ ansible_managed | comment(decoration="; ") }}
|
{{ ansible_managed | comment(decoration="; ") }}
|
||||||
|
|
||||||
hostname {{ aruba__hostname | truncate(32) | enquote }}
|
hostname {{ aruba__hostname | hostname | truncate(32) | enquote }}
|
||||||
|
|
||||||
include-credentials
|
include-credentials
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue