ansible/test/integration/targets/nxos_config/tests/cli/diff.yaml
Trishna Guha 8ab0d654f3
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>
2018-06-14 18:02:19 +05:30

33 lines
1.1 KiB
YAML

---
- 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 }}"