2018-03-09 14:54:23 +01:00
|
|
|
---
|
|
|
|
- debug: msg="START cli/check_mode.yaml on connection={{ ansible_connection }}"
|
|
|
|
|
|
|
|
- name: invalid configuration in check mode
|
|
|
|
eos_config:
|
|
|
|
lines:
|
|
|
|
- ip address 119.31.1.1 255.255.255.256
|
|
|
|
parents: interface Loopback911
|
2018-05-03 13:36:34 +02:00
|
|
|
become: yes
|
2018-03-09 14:54:23 +01:00
|
|
|
check_mode: 1
|
|
|
|
environment:
|
|
|
|
ANSIBLE_EOS_USE_SESSIONS: 1
|
|
|
|
register: result
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.msg is defined"
|
|
|
|
- "result.failed == true"
|
2018-07-02 15:19:45 +02:00
|
|
|
- "'Invalid input' in result.msg"
|
2018-03-09 14:54:23 +01:00
|
|
|
|
|
|
|
- name: valid configuration in check mode
|
|
|
|
eos_config:
|
|
|
|
before:
|
|
|
|
- "no ip access-list test"
|
|
|
|
src: basic/cmds.j2
|
2018-05-03 13:36:34 +02:00
|
|
|
become: yes
|
2018-03-09 14:54:23 +01:00
|
|
|
check_mode: yes
|
|
|
|
register: config
|
|
|
|
|
|
|
|
- name: check if session is removed
|
|
|
|
eos_command:
|
|
|
|
commands:
|
|
|
|
- show configuration sessions | json
|
2018-05-03 13:36:34 +02:00
|
|
|
become: yes
|
2018-03-09 14:54:23 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "config.session not in result.stdout[0].sessions"
|
|
|
|
|
2018-03-13 12:43:23 +01:00
|
|
|
- name: invalid configuration in check mode + no config session
|
|
|
|
eos_config:
|
|
|
|
lines:
|
|
|
|
- ip address 119.31.1.1 255.255.255.256
|
|
|
|
parents: interface Loopback911
|
2018-05-03 13:36:34 +02:00
|
|
|
become: yes
|
2018-03-13 12:43:23 +01:00
|
|
|
check_mode: 1
|
|
|
|
environment:
|
|
|
|
ANSIBLE_EOS_USE_SESSIONS: 0
|
|
|
|
register: result
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: valid configuration in check mode + no config session
|
|
|
|
eos_config:
|
|
|
|
lines:
|
|
|
|
- ip address 119.31.1.1 255.255.255.255
|
|
|
|
parents: interface Loopback911
|
2018-05-03 13:36:34 +02:00
|
|
|
become: yes
|
2018-03-13 12:43:23 +01:00
|
|
|
check_mode: yes
|
|
|
|
register: result
|
|
|
|
environment:
|
|
|
|
ANSIBLE_EOS_USE_SESSIONS: 0
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
2018-03-09 14:54:23 +01:00
|
|
|
- debug: msg="END cli/check_mode.yaml on connection={{ ansible_connection }}"
|