mirror of https://github.com/ansible/ansible.git
Don't retrieve config in running_config when config is provided for diff stable 2.5 (#41557)
* don't retrieve config in running_config when config is provided for diff (#41400)
* don't retrieve config in running_config when config is provided for diff
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
* fix for eos, nxos
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
* add integration test
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
(cherry picked from commit 8ab0d654f3
)
* add changelog
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
pull/41578/head
parent
20a55c5fdc
commit
68134cc635
@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- Don't retrieve config in running_config when config is provided for diff (https://github.com/ansible/ansible/pull/41400)
|
@ -0,0 +1,9 @@
|
||||
version 15.6
|
||||
service timestamps debug datetime msec
|
||||
service timestamps log datetime msec
|
||||
no service password-encryption
|
||||
!
|
||||
hostname an-ios-01.ansible.com
|
||||
!
|
||||
boot-start-marker
|
||||
boot-end-marker
|
@ -0,0 +1,9 @@
|
||||
version 15.6
|
||||
service timestamps debug datetime msec
|
||||
service timestamps log datetime msec
|
||||
no service password-encryption
|
||||
!
|
||||
hostname an-ios-02.ansible.com
|
||||
!
|
||||
boot-start-marker
|
||||
boot-end-marker
|
@ -0,0 +1,29 @@
|
||||
---
|
||||
- debug: msg="START cli/diff.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: ios_config diff against retrieved config
|
||||
ios_config:
|
||||
diff_against: intended
|
||||
intended_config: "{{ lookup('file', '{{ role_path }}/templates/basic/intended_running_config') }}"
|
||||
diff: true
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "'hostname an-ios-02.ansible.com' in result['diff']['after']"
|
||||
- "'hostname {{ shorter_hostname }}' in result['diff']['before']"
|
||||
|
||||
- name: ios_config diff against provided running_config
|
||||
ios_config:
|
||||
diff_against: intended
|
||||
intended_config: "{{ lookup('file', '{{ role_path }}/templates/basic/intended_running_config') }}"
|
||||
running_config: "{{ lookup('file', '{{ role_path }}/templates/basic/base_running_config') }}"
|
||||
diff: true
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "'hostname an-ios-02.ansible.com' in result['diff']['after']"
|
||||
- "'hostname an-ios-01.ansible.com' in result['diff']['before']"
|
||||
|
||||
- debug: msg="END cli/diff.yaml on connection={{ ansible_connection }}"
|
@ -0,0 +1,10 @@
|
||||
version 7.0(3)I6(1)
|
||||
hostname an-nxos9k-02.ansible.com
|
||||
vdc an-nxos9k-02 id 1
|
||||
limit-resource vlan minimum 16 maximum 4094
|
||||
limit-resource vrf minimum 2 maximum 4096
|
||||
limit-resource port-channel minimum 0 maximum 511
|
||||
limit-resource u4route-mem minimum 96 maximum 96
|
||||
limit-resource u6route-mem minimum 24 maximum 24
|
||||
limit-resource m4route-mem minimum 58 maximum 58
|
||||
limit-resource m6route-mem minimum 8 maximum 8
|
@ -0,0 +1,10 @@
|
||||
version 7.0(3)I6(1)
|
||||
hostname an-nxos9k-01.ansible.com
|
||||
vdc an-nxos9k-01 id 1
|
||||
limit-resource vlan minimum 16 maximum 4094
|
||||
limit-resource vrf minimum 2 maximum 4096
|
||||
limit-resource port-channel minimum 0 maximum 511
|
||||
limit-resource u4route-mem minimum 96 maximum 96
|
||||
limit-resource u6route-mem minimum 24 maximum 24
|
||||
limit-resource m4route-mem minimum 58 maximum 58
|
||||
limit-resource m6route-mem minimum 8 maximum 8
|
@ -0,0 +1,33 @@
|
||||
---
|
||||
- debug: msg="START cli/diff.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup hostname
|
||||
nxos_config:
|
||||
lines: hostname switch
|
||||
|
||||
- name: nxos_config diff against retrieved config
|
||||
nxos_config:
|
||||
diff_against: intended
|
||||
intended_config: "{{ lookup('file', '{{ role_path }}/templates/basic/intended_running_config') }}"
|
||||
diff: true
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "'hostname an-nxos9k-01.ansible.com' in result['diff']['after']"
|
||||
- "'hostname switch' in result['diff']['before']"
|
||||
|
||||
- name: nxos_config diff against provided running_config
|
||||
nxos_config:
|
||||
diff_against: intended
|
||||
intended_config: "{{ lookup('file', '{{ role_path }}/templates/basic/intended_running_config') }}"
|
||||
running_config: "{{ lookup('file', '{{ role_path }}/templates/basic/base_running_config') }}"
|
||||
diff: true
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "'hostname an-nxos9k-01.ansible.com' in result['diff']['after']"
|
||||
- "'hostname an-nxos9k-02.ansible.com' in result['diff']['before']"
|
||||
|
||||
- debug: msg="END cli/diff.yaml on connection={{ ansible_connection }}"
|
Loading…
Reference in New Issue