mirror of https://github.com/ansible/ansible.git
* Working Cisco IOS macro editing (fixes #55211) * Working Cisco IOS macro editing [fixed pylints] (fixes #55211) * Added integration tests for edit_macro * Added conditional integration tests for ios_config macro * Cosmetic fix: when near block for added conditional integration tests for ios_config macro * Move teardown to always for blockpull/66580/head
parent
81aabdc94f
commit
4a0c875447
@ -0,0 +1,8 @@
|
||||
A12345678 123456789 123456789 123456789 123456789 123456789 123456789
|
||||
B12345678 123456789 123456789 123456789 123456789 123456789 123456789
|
||||
C12345678 123456789 123456789 123456789 123456789 123456789 123456789
|
||||
D12345678 123456789 123456789 123456789 123456789 123456789 123456789
|
||||
E12345678 123456789 123456789 123456789 123456789 123456789 123456789
|
||||
F12345678 123456789 123456789 123456789 123456789 123456789 123456789
|
||||
G12345678 123456789 123456789 123456789 123456789 123456789 123456789
|
||||
H12345678 123456789 123456789 123456789 123456789 123456789 123456789
|
@ -0,0 +1,66 @@
|
||||
---
|
||||
|
||||
- debug: msg="START cli/cli_macro.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: "Check for macro support"
|
||||
ios_command:
|
||||
commands:
|
||||
- "show parser macro brief"
|
||||
register: supports_macro
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "ios_config macro integration tests"
|
||||
when: supports_macro is succeeded
|
||||
block:
|
||||
|
||||
- name: "Define macro name"
|
||||
set_fact:
|
||||
macro_name: 'MACRO_ANSIBLE_TEST'
|
||||
|
||||
- name: "setup - remove configuration"
|
||||
ios_config:
|
||||
lines:
|
||||
- 'no macro name {{ macro_name }}'
|
||||
- 'do show clock'
|
||||
match: none
|
||||
|
||||
- name: "configure macro"
|
||||
ios_config:
|
||||
parents: "macro name {{ macro_name }}"
|
||||
# before: [ 'no macro name ...']
|
||||
multiline_delimiter: '@'
|
||||
after: '@'
|
||||
match: line
|
||||
replace: block
|
||||
lines: "{{ lookup('template', 'basic/macro.j2') }}"
|
||||
register: result
|
||||
|
||||
- name: "Check if macro has been added"
|
||||
assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: "configure macro again - idempotent check"
|
||||
ios_config:
|
||||
parents: "macro name {{ macro_name }}"
|
||||
multiline_delimiter: '@'
|
||||
after: '@'
|
||||
match: line
|
||||
replace: block
|
||||
lines: "{{ lookup('template', 'basic/macro.j2') }}"
|
||||
register: result
|
||||
|
||||
- name: "macro already/correctly configured ?"
|
||||
assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
always:
|
||||
- name: "teardown"
|
||||
ios_config:
|
||||
lines:
|
||||
- "no macro name {{ macro_name }}"
|
||||
- 'do show clock'
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/cli_macro.yaml on connection={{ ansible_connection }}"
|
Loading…
Reference in New Issue