2017-07-03 12:01:59 +02:00
|
|
|
---
|
|
|
|
- debug: msg="START net_logging junos/basic.yaml"
|
|
|
|
|
|
|
|
- name: setup - remove host logging
|
|
|
|
net_logging:
|
|
|
|
dest: host
|
|
|
|
name: 1.1.1.1
|
|
|
|
facility: pfe
|
|
|
|
level: critical
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
|
|
|
|
- name: Create file logging
|
|
|
|
net_logging:
|
|
|
|
dest: host
|
|
|
|
name: 1.1.1.1
|
|
|
|
facility: pfe
|
|
|
|
level: critical
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'<name>1.1.1.1</name>' in config.xml"
|
|
|
|
- "'<name>pfe</name>' in config.xml"
|
|
|
|
- "'<critical/>' in config.xml"
|
|
|
|
|
|
|
|
- name: Create file logging (idempotent)
|
|
|
|
net_logging:
|
|
|
|
dest: host
|
|
|
|
name: 1.1.1.1
|
|
|
|
facility: pfe
|
|
|
|
level: critical
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: Delete logging configuration
|
|
|
|
net_logging:
|
|
|
|
dest: host
|
|
|
|
name: 1.1.1.1
|
|
|
|
facility: pfe
|
|
|
|
level: critical
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'<name>1.1.1.1</name>' not in config.xml"
|
|
|
|
|
|
|
|
- name: Configure console logging
|
|
|
|
net_logging:
|
|
|
|
dest: console
|
|
|
|
facility: kernel
|
|
|
|
level: emergency
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'<console>' in config.xml"
|
|
|
|
- "'<name>kernel</name>' in config.xml"
|
|
|
|
- "'<emergency/>' in config.xml"
|
|
|
|
|
|
|
|
- name: Configure console logging (idempotent)
|
|
|
|
junos_logging:
|
|
|
|
dest: console
|
|
|
|
facility: kernel
|
|
|
|
level: emergency
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: Delete console logging
|
|
|
|
net_logging:
|
|
|
|
dest: console
|
|
|
|
facility: kernel
|
|
|
|
level: emergency
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'<console>' not in config.xml"
|
2017-08-04 11:25:58 +02:00
|
|
|
|
|
|
|
- name: Configure file logging using aggregate
|
|
|
|
net_logging:
|
|
|
|
aggregate:
|
|
|
|
- {dest: file, name: test-1, facility: pfe, level: critical, active: True}
|
|
|
|
- {dest: file, name: test-2, facility: kernel, level: emergency, active: True}
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- result.diff.prepared | search("\+ *file test-1")
|
|
|
|
- result.diff.prepared | search("\+ *pfe critical")
|
|
|
|
- result.diff.prepared | search("\+ *file test-2")
|
|
|
|
- result.diff.prepared | search("\+ *kernel emergency")
|
|
|
|
|
|
|
|
- name: Delete file logging using aggregate
|
|
|
|
net_logging:
|
|
|
|
aggregate:
|
|
|
|
- {dest: file, name: test-1, facility: pfe, level: critical, state: absent}
|
|
|
|
- {dest: file, name: test-2, facility: kernel, level: emergency, state: absent}
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- result.diff.prepared | search("\- *file test-1")
|
|
|
|
- result.diff.prepared | search("\- *pfe critical")
|
|
|
|
- result.diff.prepared | search("\- *file test-2")
|
|
|
|
- result.diff.prepared | search("\- *kernel emergency")
|