Hi,
I’m setting up a new test network and had some plans for how I wanted to setup DNS. However I ran into a brick wall since Jinja doesn’t have a split function.
However I found that Ansible has it’s own Jinja functions and I added a simple function to ansible/runner/filter_plugins/core.py:
def get_shard(a, separator, index):
values = a.split(separator)
index = int(index)
return values[index]
(then added it under filters in the FilterModule class within that core.py file).
This solved my problem but I don’t know if this is the right place for such code, or if the function has the best name. However I would like to see this in Ansible in the future. Would you accept a filter like this in core.py? If not could it be submitted somewhere else?
So what I wanted was to be able to create a vars file as below to be able to create DNS entries under a specific domain and automatically create the reverse DNS entry.
This is my vars file: