Chapter 8 Data Models and Dynamic Templates

For diagrams, tables, or exact code formatting, .

JOHN W. CAPOBIANCOPRINTED PAGE 159
VRF 
 
--- 
 
- name: Create IOS VRF configuration  
  ios_config:  
    src: ../../templates/configurations/ios/19_ios_vrfs.j2 
    provider: "{{ ioscli }}"  
  register: global_config_results  
 
OSPF 
 
--- 
 
  - name: Create IOS OSPF 
    ios_config:  
      src: ../../templates/configurations/ios/21_ios_ospf.j2 
      provider: "{{ ioscli }}"  
    register: global_config_results
VLAN 
 
--- 
 
- name: Create IOS VLAN configuration  
  ios_config:  
    src: ../../templates/configurations/ios/23_ios_vlan.j2 
    provider: "{{ ioscli }}"  
  register: global_config_results  
  
Assemble Configuration Campus Task
--- 
 
  - name: Assembled IOS Configuration for Campus 
    ios_config:  
      src: '../../templates/configurations/ios_combined/assembled-config-campus.j2' 
      provider: "{{ ioscli }}"  
    register: global_config_results  
 
ansible.cfg

Before writing playbooks, be sure to create an ansible.cfg file located in the same folder the Ansible playbooks reside in. Here is a sample of the ansible.cfg file:

[defaults] 
host_key_checking = False 
inventory=../../hosts 
gathering=explicit 
transport=local