Created
May 18, 2023 13:58
-
-
Save aslafy-z/76d5584583189bb2ba010a5043d99ba0 to your computer and use it in GitHub Desktop.
Extract subnet list from a supernet with ansible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: localhost | |
vars: | |
supernet: "10.3.0.0/22" | |
subnet_cidr: 24 | |
subnet_size: "{{ supernet | ipsubnet(subnet_cidr) }}" | |
subnet_list: [] | |
tasks: | |
- set_fact: | |
subnet_list: "{{ subnet_list }} + ['{{ ip | ipsubnet(subnet_cidr, item) }}']" | |
with_sequence: "0-{{ subnet_size | int-1}}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment