jinja filters to iterate through IP addresses in big subnet

Hello.
I’m iterating through IP addresses (crossing boundary of last octet) by writing 2 new jinja2
filters with obvious function and content: ip2int and int2ip and following code

Inventory:

[something]
hostname1: start_offset=200 end_offset=399
hostname2: start_offset=400 end_offset=599

Playbook:

  • name: foo
    bar:
    baz: “BAZZZ={{ ((‘22.231.8.11’ | ip2int) + (item|int)) | int2ip }}”
    with_sequence: start={{ start_offset }} end={{ end_offset }}

It works. Is there an easier way to do this? Or are these filters useful enough to spend time on pull request?

Hey,

Good work. I’d say get the filters to a standard you’re happy with and then issue a PR - it’s free to do so :slight_smile: