Chapter 9 Dynamic Intent-Based Documentation

For diagrams, tables, or exact code formatting, .

JOHN W. CAPOBIANCOPRINTED PAGE 165
dest: '../../templates/documentation/ios/ios_combined.j2' 
      delegate_to: localhost 
      run_once: true  
 
    - set_fact: ios_config_file=../../configurations/ios/{{inventory_hostname}}.cfg  
 
    - name: create running configuration per device  
      template:  
        src: '../../templates/documentation/ios/ios_combined.j2'  
        dest: "{{ ios_config_file }}"  
        trim_blocks: yes  
 
- hosts: CAMPUS-CORE 
  
  vars:  
      c6k_config: "{{ lookup('file', ios_config_file) }}"  
 
  tasks:  
       
     - name: create Core documentation per device  
       template:  
         src: '../../templates/documentation/ios/Core_Documentation.j2'  
         dest: '../../documentation/campus/{{inventory_hostname}}-intent.md'  
 
- hosts: CAMPUS-DIST 
  
  vars:  
      c4k_config: "{{ lookup('file', ios_config_file) }}"  
 
  tasks:  
       
     - name: create Distribution Layer documentation per device  
       template:  
         src: '../../templates/documentation/ios/Distribution_Documentation.j2'  
         dest: '../../documentation/campus/{{inventory_hostname}}-intent.md'  
 
- hosts: CAMPUS-ACCESS 
  
  vars:  
      c3k_config: "{{ lookup('file', ios_config_file) }}"  
 
  tasks:  
       
     - name: create Access Layer documentation per device  
       template:  
         src: '../../templates/documentation/ios/Access_documentation.j2'  
         dest: '../../documentation/campus/{{inventory_hostname}}-intent.md'  
 
Here is the sample of Markdown DIST01-intent.md file. Remember the Jinja2 template is accessing 
the YAML data dictionary variables to dynamically compile this Markdown file. The documentation will 
automatically update any time the data model is updated: