Skip to content

Instantly share code, notes, and snippets.

@dgarros
Last active July 21, 2016 21:22
Show Gist options
  • Save dgarros/d4b91123d1c053368fe0dad4929d40ea to your computer and use it in GitHub Desktop.
Save dgarros/d4b91123d1c053368fe0dad4929d40ea to your computer and use it in GitHub Desktop.
Create sub interface config for Junos using jinja2
## Playbook file for Ansible
- name: Generate sub int Template
hosts: all
connection: local
gather_facts: no
tasks:
- name: Build sub interface
template: src=sub.j2 dest=./sub.conf
{% for i in range(0, 100 ) %}
{% set network = '172.16.0.0/16' | ipsubnet(24, i) %}
set interfaces xe-0/0/0 unit {{ i }} family inet address {{ network| ipaddr(1) | ipaddr('address') }}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment