Chapter 10 Configuration Management

For diagrams, tables, or exact code formatting, .

JOHN W. CAPOBIANCOPRINTED PAGE 171
- import_tasks: 
../../tasks/configurations/ios/configure_ios_host_interfaces_OPZone.yml 
    - import_tasks: 
../../tasks/configurations/ios/configure_ios_host_interfaces_SECURITY.yml 
    - import_tasks: 
../../tasks/configurations/ios/configure_ios_host_interfaces_WAP.yml 
    - import_tasks:  
../../tasks/configurations/ios/configure_ios_host_interfaces_Custom.yml 
 
- hosts: CAMPUS-DIST 
  tasks: 
    - import_tasks: ../../tasks/configurations/ios/configure_ios_dhcp.yml 
 
- hosts: CAMPUS-ACCESS 
  tasks: 
    - import_tasks: ../../tasks/configurations/ios/configure_ios_powerstack.yml 
    - import_tasks: ../../tasks/configurations/ios/configure_ios_mls_qos.yml 
    - import_tasks: ../../tasks/configurations/ios/configure_ios_dot1x.yml 
    - import_tasks: ../../tasks/configurations/ios/configure_ios_dot1x_radius.yml 
 
- hosts: CAMPUS-CORE 
  tasks: 
    - import_tasks: ../../tasks/configurations/ios/configure_ios_6k_qos.yml  
    - import_tasks: ../../tasks/configurations/ios/configure_ios_prefix_list.yml  
    - import_tasks: ../../tasks/configurations/ios/configure_ios_route_maps.yml  
    - import_tasks: ../../tasks/configurations/ios/configure_ios_static_routes.yml  
    - import_tasks: 
../../tasks/configurations/ios/configure_ios_loopback_interface.yml  
 
- hosts: CAMPUS 
  tasks: 
    - import_tasks: ../../tasks/configurations/ios/ios_copyrunstart.yml 
 
Each of the tasks uses the ios_config module and sources one of the dynamic Jinaj2 templates. For 
example, here is the configure_ios_global.yml task:

--- - name: Create IOS Global configuration ios_config: src: ../../templates/configurations/ios/01_ios_global.j2 provider: "{{ ioscli }}" register: global_config_results Make a simple change to a host_vars file, DIST01.yml, adding a VLAN just to observe the playbook’s results. Assuming the playbook was fully idempotent before this change it can been seen how all future changes to the network will look.

Create a working branch, DEMO_VLAN, in the repository. Refresh the local repository, change to this branch, and make the following changes:

First open the DIST01.yml file and add a VLAN: