add remove_domain_suffix filter

This commit is contained in:
jeltz 2022-08-27 04:22:15 +02:00
parent 5ae7126ce2
commit 15e2db49f3
Signed by: jeltz
GPG key ID: 800882B66C0C3326
2 changed files with 14 additions and 0 deletions

View file

@ -3,6 +3,7 @@ ask_vault_pass = True
roles_path = ./roles roles_path = ./roles
retry_files_enabled = False retry_files_enabled = False
inventory = ./hosts inventory = ./hosts
filter_plugins = ./filter_plugins
ansible_managed = Ansible managed, modified on %Y-%m-%d %H:%M:%S ansible_managed = Ansible managed, modified on %Y-%m-%d %H:%M:%S
nocows = 1 nocows = 1
forks = 15 forks = 15

View 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()