mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
1c8c51d05c
* Add connection=netconf in individual roles for modules that run using netconf connection plugin * Add connection=network_cli for junos_netconf and junos_command at applicable places
194 lines
4.2 KiB
YAML
194 lines
4.2 KiB
YAML
---
|
|
- debug: msg="START junos_banner netconf/basic.yaml on connection={{ ansible_connection }}"
|
|
|
|
- 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
|
|
|
|
- name: Get running configuration
|
|
junos_rpc:
|
|
rpc: get-configuration
|
|
provider: "{{ netconf }}"
|
|
register: config
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'<message>this is my login banner</message>' in config.xml"
|
|
|
|
- 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
|
|
state: present
|
|
active: False
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- name: Get running configuration
|
|
junos_rpc:
|
|
rpc: get-configuration
|
|
provider: "{{ netconf }}"
|
|
register: config
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'<message inactive=\"inactive\">this is my login banner</message>' in config.xml"
|
|
|
|
- name: Activate login banner
|
|
junos_banner:
|
|
banner: login
|
|
text: this is my login banner
|
|
state: present
|
|
active: True
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- name: Get running configuration
|
|
junos_rpc:
|
|
rpc: get-configuration
|
|
provider: "{{ netconf }}"
|
|
register: config
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'<message>this is my login banner</message>' in config.xml"
|
|
|
|
- name: delete login banner
|
|
junos_banner:
|
|
banner: login
|
|
state: absent
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- name: Get running configuration
|
|
junos_rpc:
|
|
rpc: get-configuration
|
|
provider: "{{ netconf }}"
|
|
register: config
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'<message>this is my login banner</message>' not in config.xml"
|
|
|
|
- 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
|
|
|
|
- name: Get running configuration
|
|
junos_rpc:
|
|
rpc: get-configuration
|
|
provider: "{{ netconf }}"
|
|
register: config
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'<announcement>this is my motd banner</announcement>' in config.xml"
|
|
|
|
- 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
|
|
text: this is my motd banner
|
|
state: present
|
|
active: False
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- name: Get running configuration
|
|
junos_rpc:
|
|
rpc: get-configuration
|
|
provider: "{{ netconf }}"
|
|
register: config
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'<announcement inactive=\"inactive\">this is my motd banner</announcement>' in config.xml"
|
|
|
|
- name: Activate motd banner
|
|
junos_banner:
|
|
banner: motd
|
|
text: this is my motd banner
|
|
state: present
|
|
active: True
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- name: Get running configuration
|
|
junos_rpc:
|
|
rpc: get-configuration
|
|
provider: "{{ netconf }}"
|
|
register: config
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'<announcement>this is my motd banner</announcement>' in config.xml"
|
|
|
|
- name: delete motd banner
|
|
junos_banner:
|
|
banner: motd
|
|
state: absent
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- name: Get running configuration
|
|
junos_rpc:
|
|
rpc: get-configuration
|
|
provider: "{{ netconf }}"
|
|
register: config
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'<announcement>this is my motd banner</announcement>' not in config.xml"
|
|
|
|
- debug: msg="END junos_banner netconf/basic.yaml on connection={{ ansible_connection }}"
|