Skip to content

Instantly share code, notes, and snippets.

@QuinnyPig
Created October 29, 2014 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save QuinnyPig/7128c2c9920a8406f8ae to your computer and use it in GitHub Desktop.
Save QuinnyPig/7128c2c9920a8406f8ae to your computer and use it in GitHub Desktop.
With Pillar data that looks like:
vlans:
id:
100:
network:
- 10.20.0.0
netmask:
- 255.255.255.0
prefix:
- 10.20.0
gateway:
- 10.20.0.1
id:
101:
network:
- 10.21.0.0
netmask:
- 255.255.255.0
prefix:
- 10.21.0
gateway:
- 10.21.0.1
What does this become:
{%- for vlan in grains.vlans %}
subnet {{ vlan.network }} netmask {{ vlan.netmask }} {
option routers {{ vlan.gateway }};
option subnet-mask {{ vlan.netmask }};
range {{ vlan.prefix }}.200 {{ vlan.prefix }}.240;
default-lease-time 1200;
max-lease-time 2400;
}
{%- endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment