---
- debug: msg="START junos_logging netconf/basic.yaml"
- name: setup - remove file logging
junos_logging:
dest: file
name: test
facility: pfe
level: error
state: absent
provider: "{{ netconf }}"
- name: Create file logging
junos_logging:
dest: file
name: test_file
facility: pfe
level: error
state: present
provider: "{{ netconf }}"
register: result
- name: Get running configuration
junos_rpc:
rpc: get-configuration
provider: "{{ netconf }}"
register: config
- assert:
that:
- "result.changed == true"
- "'test_file' in config.xml"
- "'pfe' in config.xml"
- "'' in config.xml"
- name: Create file logging (idempotent)
junos_logging:
dest: file
name: test_file
facility: pfe
level: error
state: present
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- name: Deactivate logging configuration
junos_logging:
dest: file
name: test_file
facility: pfe
level: error
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"
- "'' in config.xml"
- "'' in config.xml"
- name: Activate logging configuration
junos_logging:
dest: file
name: test_file
facility: pfe
level: error
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"
- "'test_file' in config.xml"
- "'pfe' in config.xml"
- "'' in config.xml"
- name: Delete logging configuration
junos_logging:
dest: file
name: test_file
facility: pfe
level: error
state: absent
provider: "{{ netconf }}"
register: result
- name: Get running configuration
junos_rpc:
rpc: get-configuration
provider: "{{ netconf }}"
register: config
- assert:
that:
- "result.changed == true"
- "'test_file' not in config.xml"
- name: Configure console logging
junos_logging:
dest: console
facility: kernel
level: emergency
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"
- "'' in config.xml"
- "'kernel' in config.xml"
- "'' in config.xml"
- name: Configure console logging (idempotent)
junos_logging:
dest: console
facility: kernel
level: emergency
state: present
active: True
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- name: Disable console logging
junos_logging:
dest: console
facility: kernel
level: emergency
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"
- "'' in config.xml"
- name: Delete console logging
junos_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"
- "'' not in config.xml"
- name: Configure logging parameters
junos_logging:
size: 65536
files: 40
rotate_frequency: 20
state: present
provider: "{{ netconf }}"
register: result
- name: Get running configuration
junos_rpc:
rpc: get-configuration
provider: "{{ netconf }}"
register: config
- assert:
that:
- "result.changed == true"
- "'64k' in config.xml"
- "'40' in config.xml"
- "'20' in config.xml"
- name: Configure logging parameters (idempotent)
junos_logging:
size: 65536
files: 40
rotate_frequency: 20
state: present
active: True
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- name: Disable logging parameters
junos_logging:
size: 65536
files: 40
rotate_frequency: 20
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"
- "'64k' in config.xml"
- "'40' in config.xml"
- "'20' in config.xml"
- name: Activate logging parameters
junos_logging:
size: 65536
files: 40
rotate_frequency: 20
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"
- "'64k' in config.xml"
- "'40' in config.xml"
- "'20' in config.xml"
- name: Delete logging parameters
junos_logging:
size: 65536
files: 40
rotate_frequency: 20
state: absent
provider: "{{ netconf }}"
register: result
- name: Get running configuration
junos_rpc:
rpc: get-configuration
provider: "{{ netconf }}"
register: config
- assert:
that:
- "result.changed == true"
- "'64k' not in config.xml"
- "'40' not in config.xml"
- "'20' not in config.xml"