2017-03-10 16:20:09 +01:00
|
|
|
---
|
2017-12-19 21:49:49 +01:00
|
|
|
- debug: msg="START cli/basic-motd.yaml on connection={{ ansible_connection }}"
|
|
|
|
|
2017-07-11 19:28:33 +02:00
|
|
|
- name: Remove previous motd banner
|
|
|
|
eos_config:
|
|
|
|
lines: no banner motd
|
2017-03-10 16:20:09 +01:00
|
|
|
authorize: yes
|
2017-03-31 00:21:23 +02:00
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-03-10 16:20:09 +01:00
|
|
|
|
2017-07-11 19:28:33 +02:00
|
|
|
- name: Create motd
|
2017-03-10 16:20:09 +01:00
|
|
|
eos_banner:
|
|
|
|
banner: motd
|
|
|
|
text: |
|
|
|
|
this is my motd banner
|
|
|
|
that has a multiline
|
|
|
|
string
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-03-10 16:20:09 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'this is my motd banner' in result.commands"
|
|
|
|
- "'that has a multiline' in result.commands"
|
|
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
|
|
- "'ansible_1' in result.session_name"
|
|
|
|
|
2017-07-11 19:28:33 +02:00
|
|
|
- name: Create motd again (idempotent)
|
2017-03-10 16:20:09 +01:00
|
|
|
eos_banner:
|
|
|
|
banner: motd
|
|
|
|
text: |
|
|
|
|
this is my motd banner
|
|
|
|
that has a multiline
|
|
|
|
string
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-03-10 16:20:09 +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"
|
|
|
|
|
2017-07-11 19:28:33 +02:00
|
|
|
- name: Remove motd
|
|
|
|
eos_banner:
|
|
|
|
banner: motd
|
|
|
|
text: |
|
|
|
|
this is my motd banner
|
|
|
|
that has a multiline
|
|
|
|
string
|
|
|
|
state: absent
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-07-11 19:28:33 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'no banner motd' in result.commands"
|
|
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
|
|
- "'ansible_1' in result.session_name"
|
|
|
|
|
|
|
|
- name: Remove motd again (idempotent)
|
|
|
|
eos_banner:
|
|
|
|
banner: motd
|
|
|
|
text: |
|
|
|
|
this is my motd banner
|
|
|
|
that has a multiline
|
|
|
|
string
|
|
|
|
state: absent
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-07-11 19:28:33 +02: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"
|
2017-03-10 16:20:09 +01:00
|
|
|
|
|
|
|
# FIXME add in tests for everything defined in docs
|
|
|
|
# FIXME Test state:absent + test:
|
|
|
|
# FIXME Without powers ensure "privileged mode required"
|