ansible/test/integration/targets/eos_banner/tests/eapi/basic-login.yaml

89 lines
2.2 KiB
YAML
Raw Normal View History

2017-03-10 16:29:36 +01:00
---
- debug: msg="START eapi/basic-login.yaml on connection={{ ansible_connection }}"
2017-03-10 16:29:36 +01:00
- name: Remove previous login banner
eos_config:
lines: no banner login
2017-03-10 16:29:36 +01:00
authorize: yes
provider: "{{ eapi }}"
2017-03-10 16:29:36 +01:00
- name: Create login banner
2017-03-10 16:29:36 +01:00
eos_banner:
banner: login
text: |
this is my login banner
that has a multiline
string
state: present
authorize: yes
provider: "{{ eapi }}"
2017-03-10 16:29:36 +01:00
register: result
- assert:
that:
- "result.changed == true"
- "'banner login' in result.commands[0]" # does this break due to "contains?"
2017-03-10 16:29:36 +01:00
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "'ansible_1' in result.session_name"
- name: Create login banner again (idempotent)
2017-03-10 16:29:36 +01:00
eos_banner:
banner: login
text: |
this is my login banner
that has a multiline
string
state: present
authorize: yes
provider: "{{ eapi }}"
2017-03-10 16:29:36 +01:00
register: result
- assert:
that:
- "result.changed == false"
- "result.commands | length == 0"
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "result.session_name is not defined"
- name: Remove login
eos_banner:
banner: login
text: |
this is my login banner
that has a multiline
string
state: absent
authorize: yes
provider: "{{ eapi }}"
register: result
- assert:
that:
- "result.changed == true"
- "'no banner login' in result.commands" # does this break due to "contains?"
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "'ansible_1' in result.session_name"
- name: Remove login again (idempotent)
eos_banner:
banner: login
text: |
this is my login banner
that has a multiline
string
state: absent
authorize: yes
provider: "{{ eapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.commands | length == 0"
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "result.session_name is not defined"
2017-03-10 16:29:36 +01:00
# FIXME add in tests for everything defined in docs
# FIXME Test state:absent + test:
# FIXME Without powers ensure "privileged mode required"