Chapter 9 Dynamic Intent-Based Documentation
For diagrams, tables, or exact code formatting, .
JOHN W. CAPOBIANCOPRINTED PAGE 164
## {{ inventory_hostname }}
**VLANs**
| VLAN | Name |
| ----- | ------ |
| {{ global_campus_defaults.native_vlan }} | NativeVLAN |
{% for host_vlan in host_vlans|dictsort() %}
| {{ host_vlan }} | {{ host_vlans[host_vlan].name }} |
{% endfor %}
### Running Configuration
```
{{ core_config }}
```
This template generates a dynamic Markdown file displaying in tabular format the variable
information. In this example all VLANs followed by the full generated configuration of the device is
displayed. Every variable in the data model is available to be manipulated into human-readable
documentation files.Assemble The Ansible assemble module is used to combine the smaller, modular, fragmented templates and build, or assemble, them into a single Jinja2 template. The following lines indicate the source of the fragments, or Jinja2 templates, and the destination where to compile the assembled template:
assemble:
src: ../../templates/configurations/ios/
dest: '../../templates/documentation/ios/ios_combined.j2'More details about the assemble module are available here: https://docs.ansible.com/ansible/latest/modules/assemble_module.html Write the following documentation.yml Ansible playbook to generate both the configuration file per- device as well as the Markdown documentation using the template above for the core, distribution, and access layers. Examine and breakdown the following playbook:
---
- hosts: CAMPUS
tasks:
- name: create IOS combined template
assemble:
src: ../../templates/configurations/ios/