---
- 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"
- "'1.1.1.1' in config.xml"
- "'pfe' in config.xml"
- "'' 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"
- "'1.1.1.1' 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"
- "'' 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
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"
- "'' not in config.xml"