title: Ansible & Jinja 2 templates - vars .yml additions
body: <p>First spin with Ansible and I'm trying to do a relatively basic thing. I have created a Jinja2 template to output a configuration for a Nexus switch. It seems to work fine. I am following the folder structure where the top directory is the 'role' and within that directory are subdirectories of 'tasks' , 'templates', and 'vars'. Under the 'vars' directory I have one file named main.yml as I understand it should be. What I'd like to have is multiple vars files that contain various different elements so I can make the whole thing more modular.</p>
  
  <p>Here are a few configs I have currently:</p>
  
  <p><strong>The playbook I run in the top directory:</strong></p>
  
  <pre><code>    ---
      - name: Apply tor role   
        gather_facts: no   
        hosts: localhost
  
        roles:
          - tor
  </code></pre>
  
  <p><strong>tor/tasks/main.yml file</strong></p>
  
  <pre><code>    - name: Generate Configs
        template: src={{ item.profile }}.j2 dest=staging/drc/{{ item.hostname }}/{{ item.hostname }}.cfg
        with_items: "{{ switches }}"
  </code></pre>
  
  <p><strong>And a snippet of the main.yml file in the vars directory:</strong></p>
  
  <pre><code>---
    switches:
      - hostname: 5K01
        profile: nxos_template
        mgmt_ip: 10.20.90.9/24
        vlans:
        - {vlan_name: LegacyData, vlan_number: '5'}
        - {vlan_name: Voice, vlan_number: '20'}
        - {vlan_name: Data_Center, vlan_number: '50'}
        - {vlan_name: Vmotion, vlan_number: '51'}
        - {vlan_name: Citrix, vlan_number: '52'}
        - {vlan_name: Citrix_XEN, vlan_number: '56'}
        - {vlan_name: Citrix_Green_Infrastructure, vlan_number: '61'}
        - {vlan_name: Citrix_Red_Ingrastructure, vlan_number: '62'}
        - {vlan_name: Citrix_Green_XenApp, vlan_number: '63'}
        - {vlan_name: Citrix_Yellow, vlan_number: '64'}
        - {vlan_name: Citrix_Red_Desktops, vlan_number: '68'}
        - {vlan_name: Zerto-VRA-Network, vlan_number: '90'}
        - {vlan_name: Management, vlan_number: '92'}
        - {vlan_name: PCI_FW_Intermediate_Network, vlan_number: '121'}
        features:
          - nxapi
          - interface-vlan
          - hsrp
          - lacp
          - vpc
          - eigrp
          - npiv
          - fcoe
          - fport-channel-trunk
          - dhcp
          - fex
          - lldp
  </code></pre>
  
  <p>I would like to remove the vlans: dict to another vars file named vlans.yml. I figure I'd place that in the same directory as the current main.yml vars file and call the vlans.yml file out somewhere. I've tried to use the 'include_vars:' option but it won't take, specifically gives me an error when it is used within the same block as the 'template:' action.</p>