add remove_domain_suffix filter
This commit is contained in:
parent
5ae7126ce2
commit
15e2db49f3
2 changed files with 14 additions and 0 deletions
|
@ -3,6 +3,7 @@ ask_vault_pass = True
|
|||
roles_path = ./roles
|
||||
retry_files_enabled = False
|
||||
inventory = ./hosts
|
||||
filter_plugins = ./filter_plugins
|
||||
ansible_managed = Ansible managed, modified on %Y-%m-%d %H:%M:%S
|
||||
nocows = 1
|
||||
forks = 15
|
||||
|
|
13
filter_plugins/net_utils.py
Normal file
13
filter_plugins/net_utils.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
import dns.name
|
||||
|
||||
|
||||
class FilterModule:
|
||||
def filters(self):
|
||||
return {
|
||||
"remove_domain_suffix": remove_domain_suffix,
|
||||
}
|
||||
|
||||
|
||||
def remove_domain_suffix(name):
|
||||
parent = dns.name.from_text(name).parent()
|
||||
return parent.to_text()
|
Loading…
Reference in a new issue