-
Notifications
You must be signed in to change notification settings - Fork 1
/
data-model-compare.yml
57 lines (55 loc) · 1.7 KB
/
data-model-compare.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
- name: Building configuration from data model
hosts: all
connection: local
gather_facts: false
tags: ['build', 'validate']
vars:
config_dir: "configs"
build_dir: "compiled"
pre_tasks:
- name: Set global facts, cleanup old files and directories
set_fact:
host_dir: "{{ config_dir }}/{{ build_dir }}/{{ inventory_hostname }}"
changed_when: false
check_mode: true
- name: Clearing old build configuration files
file: path={{ host_dir }} state=absent
changed_when: false
check_mode: false
- name: Rebuild build configuration directories
file: path={{ host_dir }} state=directory
changed_when: false
check_mode: false
- name: Building configuration components
hosts: all
connection: local
tags: ['build', 'validate']
vars:
model_dir: "datamodel"
vars_files:
- "{{ model_dir }}/node-model.yml"
roles:
- base
- common
- interfaces
- routing
post_tasks:
- name: Assembling configuration components
tags: ['build', 'validate']
assemble:
src: "{{ host_dir }}"
dest: "{{ host_dir }}/assembled.conf"
changed_when: false
- name: Compare data model with config on device, report the differences
tags: ['validate']
napalm_install_config:
hostname: "{{ inventory_hostname }}"
username: "{{ username }}"
password: "{{ password }}"
dev_os: "{{ os }}"
config_file: "{{ host_dir }}/assembled.conf"
replace_config: false
get_diffs: true
commit_changes: false
diff_file: "{{ host_dir }}/config-diff"