Hi All,
I’ve created a facts module to calculate subnet block addresses.
This is helpful when creating new subnets on for instance Amazon EC2.
Example usage:
- name: get subnet blocks
local_action:
module: subnet_block_facts
start_address: 183.0.0.0
prefix: 16
subnet_prefix: 22
Which returns this:
{
“ansible_facts”: {
“subnet_addresses”: {
“blocks”: [
{
“block_address”: “183.0.0.0/22”,
“first_address”: “183.0.0.0”,
“last_address”: “183.0.3.255”
},
…
{
“block_address”: “183.0.252.0/22”,
“first_address”: “183.0.252.0”,
“last_address”: “183.0.255.255”
}
],
“first_address”: “183.0.0.0”,
“max_number_subnets”: 64,
“subnet_prefix”: 22,
“subnet_size”: 1024,
“total_block”: “183.0.0.0/16”,
“total_prefix”: 16
}
},
“changed”: false
}
Now I have 2 questions:
1: Would the Ansible community be interested in adding this to the distribution ?
2: If so, would this be the best way of naming things ?
regards,
Paul Siegmann