2017-06-17 22:02:48 +02:00
|
|
|
---
|
|
|
|
- debug: msg="START junos_banner netconf/basic.yaml"
|
|
|
|
|
|
|
|
- name: setup - remove login banner
|
|
|
|
junos_banner:
|
|
|
|
banner: login
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
|
|
|
|
- name: Create login banner
|
|
|
|
junos_banner:
|
|
|
|
banner: login
|
|
|
|
text: this is my login banner
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-17 22:02:48 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<message>this is my login banner</message>' in config.xml"
|
2017-06-17 22:02:48 +02:00
|
|
|
|
|
|
|
- name: Create login banner (idempotent)
|
|
|
|
junos_banner:
|
|
|
|
banner: login
|
|
|
|
text: this is my login banner
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: Deactivate login banner
|
|
|
|
junos_banner:
|
|
|
|
banner: login
|
|
|
|
text: this is my login banner
|
2017-06-29 06:48:35 +02:00
|
|
|
state: present
|
|
|
|
active: False
|
2017-06-17 22:02:48 +02:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-17 22:02:48 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<message inactive=\"inactive\">this is my login banner</message>' in config.xml"
|
2017-06-17 22:02:48 +02:00
|
|
|
|
|
|
|
- name: Activate login banner
|
|
|
|
junos_banner:
|
|
|
|
banner: login
|
|
|
|
text: this is my login banner
|
2017-06-29 06:48:35 +02:00
|
|
|
state: present
|
|
|
|
active: True
|
2017-06-17 22:02:48 +02:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-17 22:02:48 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<message>this is my login banner</message>' in config.xml"
|
2017-06-17 22:02:48 +02:00
|
|
|
|
|
|
|
- name: delete login banner
|
|
|
|
junos_banner:
|
|
|
|
banner: login
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-17 22:02:48 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<message>this is my login banner</message>' not in config.xml"
|
2017-06-17 22:02:48 +02:00
|
|
|
|
|
|
|
- name: setup - remove motd banner
|
|
|
|
junos_banner:
|
|
|
|
banner: motd
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
|
|
|
|
- name: Create motd banner
|
|
|
|
junos_banner:
|
|
|
|
banner: motd
|
|
|
|
text: this is my motd banner
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
2017-06-17 22:02:48 +02:00
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<announcement>this is my motd banner</announcement>' in config.xml"
|
2017-06-17 22:02:48 +02:00
|
|
|
|
|
|
|
- name: Create motd banner (idempotent)
|
|
|
|
junos_banner:
|
|
|
|
banner: motd
|
|
|
|
text: this is my motd banner
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: Deactivate motd banner
|
|
|
|
junos_banner:
|
|
|
|
banner: motd
|
2017-06-29 06:48:35 +02:00
|
|
|
text: this is my motd banner
|
|
|
|
state: present
|
|
|
|
active: False
|
2017-06-17 22:02:48 +02:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-17 22:02:48 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<announcement inactive=\"inactive\">this is my motd banner</announcement>' in config.xml"
|
2017-06-17 22:02:48 +02:00
|
|
|
|
|
|
|
- name: Activate motd banner
|
|
|
|
junos_banner:
|
|
|
|
banner: motd
|
2017-06-29 06:48:35 +02:00
|
|
|
text: this is my motd banner
|
|
|
|
state: present
|
|
|
|
active: True
|
2017-06-17 22:02:48 +02:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-17 22:02:48 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<announcement>this is my motd banner</announcement>' in config.xml"
|
2017-06-17 22:02:48 +02:00
|
|
|
|
|
|
|
- name: delete motd banner
|
|
|
|
junos_banner:
|
|
|
|
banner: motd
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-17 22:02:48 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<announcement>this is my motd banner</announcement>' not in config.xml"
|