ansible/test/integration/targets/eos_config/tests/cli/check_mode.yaml
Nathaniel Case e9d7fa0418
HTTP(S) API connection plugin (#39224)
* HTTPAPI connection

* Punt run_commands to cliconf or httpapi

* Fake enable_mode on eapi

* Pull changes to nxos

* Move load_config to edit_config for future-preparedness

* Don't fail on lldp disabled

* Re-enable check_rc on nxos' run_commands

* Reorganize nxos httpapi plugin for compatibility

* draft docs for connection: httpapi

* restores docs for connection:local for eapi

* Add _remote_is_local to httpapi
2018-05-17 18:47:15 -04:00

73 lines
1.6 KiB
YAML

---
- 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
become: yes
check_mode: 1
environment:
ANSIBLE_EOS_USE_SESSIONS: 1
register: result
ignore_errors: yes
- assert:
that:
- "result.msg is defined"
- "result.failed == true"
- "'Error on executing commands' in result.msg"
- name: valid configuration in check mode
eos_config:
before:
- "no ip access-list test"
src: basic/cmds.j2
become: yes
check_mode: yes
register: config
- name: check if session is removed
eos_command:
commands:
- show configuration sessions | json
become: yes
register: result
- assert:
that:
- "config.session not in result.stdout[0].sessions"
- 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
become: yes
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
become: yes
check_mode: yes
register: result
environment:
ANSIBLE_EOS_USE_SESSIONS: 0
- assert:
that:
- "result.changed == true"
- debug: msg="END cli/check_mode.yaml on connection={{ ansible_connection }}"