# CONFIG GENERATOR
# THIS IS THE PLAYBOOK

---
- hosts: crpashnetdev01
  connection: local
  gather_facts: no
  vars_files:
    - vars/vrf_vars.yml
  tasks:
  - name: Generate Configs
    template:
        src: "templates/vrf_templates_prd_switch01.j2"
        dest: "/home/.../xxx-DMZR01-{{client_name}}-maxtranet.cfg"

#########################

$ cat vars/vrf_vars.yml
---
    #Client Info
    - client_name: NAME 
    - client_as: XXXXX
    - client_cage_num: XXXXX
    - client_contact_info: NOC-XXXX
    #IP INFO For interfaces/bgp
    - interface_ip_nearside_dmz01: 10.X.X.X
    - interface_ip_nearside_dmz02: 10.X.X.X
    - interface_ip_farside_dmz01:  10.X.X.X
    - interface_ip_farside_dmz02:  10.X.X.X
    #
    # need a loop for routes
    - recieved_routes: 
        #This is my list of received routes add as many as you need
        - ip: 10.X.X.X
          slashnotation: 32
          netmask: 255.255.255.255
       #- ip: 10.X.X.X
       #  slashnotation: 24
       #  netmask: 255.255.255.0
       #- ip: 10.X.X.X
       #  slashnotation: 25
       #  netmask: 255.255.255.128
       #- ip: 10.X.X.X
       #  slashnotation: 25
       #  netmask: 255.255.255.128
          
    #      
    # we are the Z side
    - cable_id_dmz01: XXXXXX
    - cable_id_dmz02: XXXXXX
    #you dont need to define Gi
    - interface_number: 3/29
    - bgp_password: xxxxxx
    # enter one of these two values "bfd interval Y min_rx 50 multiplier Z"  "udld port aggressive" 
    - path_failure_detection: udld port aggressive
    # whatever you enter, make it uppercase 
    - colo_number: XXXX
######################################
# JINYA FILE WITH A LOOP
$ cat vrf_templates_drn_firewall.j2
{# this is XXX --- NAME-FWALL#}

{# this is the loop for all of teh client named routes for the firewall#}
{% for route in recieved_routes%}
name {{route.ip}} {{client_name}}-NAT-{{route.ip}}.max.clientip.mktx.net
{%endfor%}

{# this is the loop for the cient routes in the firewall#}
{% for route in recieved_routes%}
route maxout {{route.ip}} {{route.netmask}} 10.30.251.212 1
{%endfor%}
