junipernetworks.junos.junos_logging_global module – Manage logging configuration on Junos devices.
Note
This module is part of the junipernetworks.junos collection (version 9.1.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install junipernetworks.junos
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: junipernetworks.junos.junos_logging_global
.
New in junipernetworks.junos 2.4.0
Synopsis
This module manages logging configuration on devices running Junos.
Aliases: logging_global
Requirements
The below requirements are needed on the host that executes this module.
ncclient (>=v0.6.4)
xmltodict (>=0.12.0)
Parameters
Parameter |
Comments |
---|---|
A dictionary of logging configuration. |
|
Do not suppress the repeated message for all targets. Choices:
|
|
Specify archive file information. |
|
Mark file as if it contains binary data. Choices:
|
|
Size of files to be archived (65536..1073741824 bytes). |
|
Specify number of files to be archived (1..1000). |
|
Don’t mark file as if it contains binary data. Choices:
|
|
Don’t allow any user to read the log file. Choices:
|
|
Set archive file information. Choices:
|
|
Allow any user to read the log file. Choices:
|
|
Set console logging parameters. |
|
Set All facilities. |
|
Set severity logging level. Choices:
|
|
Specify authorization system. |
|
Set severity logging level. Choices:
|
|
Specify configuration change log. |
|
Set severity logging level. Choices:
|
|
Specify configuration conflict log. |
|
Set severity logging level. Choices:
|
|
Specify various system processes. |
|
Set severity logging level. Choices:
|
|
Specify dynamic flow capture. |
|
Set severity logging level. Choices:
|
|
Specify Local external applications. |
|
Set severity logging level. Choices:
|
|
Specify Firewall filtering system. |
|
Set severity logging level. Choices:
|
|
Specify FTP process. |
|
Set severity logging level. Choices:
|
|
Specify commands executed by the UI. |
|
Set severity logging level. Choices:
|
|
Specify Kernel specific logging. |
|
Set severity logging level. Choices:
|
|
Specify NTP process specific logging. |
|
Set severity logging level. Choices:
|
|
Specify Packet Forwarding Engine specific logging. |
|
Set severity logging level. Choices:
|
|
Specify Security related logging. |
|
Set severity logging level. Choices:
|
|
Specify user specific logging. |
|
Set severity logging level. Choices:
|
|
Specify files logging. |
|
Do not suppress the repeated message for all targets. Choices:
|
|
Set All facilities. |
|
Set severity logging level. Choices:
|
|
Specify archive file information. |
|
Specify Primary and failover URLs to receive archive facilities. |
|
Mark file as if it contains binary data. Choices:
|
|
Size of files to be archived (65536..1073741824 bytes). |
|
Specify number of files to be archived (1..1000). |
|
Don’t mark file as if it contains binary data. Choices:
|
|
Don’t allow any user to read the log file. Choices:
|
|
Set archive file information. Choices:
|
|
Specify start time for file transmission (yyyy-mm-dd.hh:mm). |
|
Specify frequency at which to transfer files to archive sites (5..2880 minutes). |
|
Allow any user to read the log file. Choices:
|
|
Specify authorization system. |
|
Set severity logging level. Choices:
|
|
Specify configuration change log. |
|
Set severity logging level. Choices:
|
|
Specify configuration conflict log. |
|
Set severity logging level. Choices:
|
|
Specify various system processes. |
|
Set severity logging level. Choices:
|
|
Specify dynamic flow capture. |
|
Set severity logging level. Choices:
|
|
Include priority and facility in messages. Choices:
|
|
Specify Local external applications. |
|
Set severity logging level. Choices:
|
|
Specify Firewall filtering system. |
|
Set severity logging level. Choices:
|
|
Specify FTP process. |
|
Set severity logging level. Choices:
|
|
Specify commands executed by the UI. |
|
Set severity logging level. Choices:
|
|
Specify Kernel specific logging. |
|
Set severity logging level. Choices:
|
|
Specify regular expression for lines to be logged. |
|
Specify matching string(s) for lines to be logged. |
|
Specify filename in which to log data. |
|
Specify NTP process specific logging. |
|
Set severity logging level. Choices:
|
|
Specify Packet Forwarding Engine specific logging. |
|
Set severity logging level. Choices:
|
|
Specify Security related logging. |
|
Set severity logging level. Choices:
|
|
Specify Log system message in structured format. |
|
Omit English-language text from end of logged messages. Choices:
|
|
Set Log system message in structured format. Choices:
|
|
Specify user specific logging. |
|
Set severity logging level. Choices:
|
|
Specify hosts to be notified. |
|
Do not suppress the repeated message for all targets. Choices:
|
|
Set All facilities. |
|
Set severity logging level. Choices:
|
|
Specify authorization system. |
|
Set severity logging level. Choices:
|
|
Specify configuration change log. |
|
Set severity logging level. Choices:
|
|
Specify configuration conflict log. |
|
Set severity logging level. Choices:
|
|
Specify various system processes. |
|
Set severity logging level. Choices:
|
|
Specify dynamic flow capture. |
|
Set severity logging level. Choices:
|
|
Specify exclude hostname field in messages. Choices:
|
|
Include priority and facility in messages. Choices:
|
|
Specify Local external applications. |
|
Set severity logging level. Choices:
|
|
Specify alternate facility for logging to remote host. |
|
Specify Firewall filtering system. |
|
Set severity logging level. Choices:
|
|
Specify FTP process. |
|
Set severity logging level. Choices:
|
|
Specify commands executed by the UI. |
|
Set severity logging level. Choices:
|
|
Specify Kernel specific logging. |
|
Set severity logging level. Choices:
|
|
Prefix for all logging to this host. |
|
Specify regular expression for lines to be logged. |
|
Specify matching string(s) for lines to be logged. |
|
Specify the host name. |
|
Specify NTP process specific logging. |
|
Set severity logging level. Choices:
|
|
Specify Packet Forwarding Engine specific logging. |
|
Set severity logging level. Choices:
|
|
Specify port number. |
|
Specify routing-instance. |
|
Specify Security related logging. |
|
Set severity logging level. Choices:
|
|
Specify address as source address. |
|
Specify Log system message in structured format. |
|
Omit English-language text from end of logged messages. Choices:
|
|
Set Log system message in structured format. Choices:
|
|
Specify user specific logging. |
|
Set severity logging level. Choices:
|
|
Specify Rotate log frequency (1..59 minutes). |
|
Specify Routing routing-instance. |
|
Specify syslog server logging. |
|
nable/disable syslog server in routing-instances. |
|
Enable/disable all routing instances. Choices:
|
|
Enable/disable default routing instances. Choices:
|
|
Specify routing-instances. |
|
Disable syslog server in this routing instances. Choices:
|
|
Specify routing-instance name. |
|
Enable syslog server. Choices:
|
|
Specify address as source address. |
|
Specify additional information to include in system log timestamp. |
|
Include milliseconds in timestamp. Choices:
|
|
Set time-format Choices:
|
|
Include year in timestamp. Choices:
|
|
Specify user logging |
|
Do not suppress the repeated message for all targets. Choices:
|
|
Set All facilities. |
|
Set severity logging level. Choices:
|
|
Specify authorization system. |
|
Set severity logging level. Choices:
|
|
Specify configuration change log. |
|
Set severity logging level. Choices:
|
|
Specify configuration conflict log. |
|
Set severity logging level. Choices:
|
|
Specify various system processes. |
|
Set severity logging level. Choices:
|
|
Specify dynamic flow capture. |
|
Set severity logging level. Choices:
|
|
Specify Local external applications. |
|
Set severity logging level. Choices:
|
|
Specify Firewall filtering system. |
|
Set severity logging level. Choices:
|
|
Specify FTP process. |
|
Set severity logging level. Choices:
|
|
Specify commands executed by the UI. |
|
Set severity logging level. Choices:
|
|
Specify Kernel specific logging. |
|
Set severity logging level. Choices:
|
|
Specify regular expression for lines to be logged. |
|
Specify matching string(s) for lines to be logged. |
|
Specify user name. |
|
Specify NTP process specific logging. |
|
Set severity logging level. Choices:
|
|
Specify Packet Forwarding Engine specific logging. |
|
Set severity logging level. Choices:
|
|
Specify Security related logging. |
|
Set severity logging level. Choices:
|
|
Specify user specific logging. |
|
Set severity logging level. Choices:
|
|
This option is used only with state parsed. The value of this option should be the output received from the Junos device by executing the command show system syslog. The state parsed reads the configuration from |
|
The state the configuration should be left in. Refer to examples for more details. Choices:
|
Notes
Note
This module requires the netconf system service be enabled on the device being managed.
This module works with connection
netconf
.Tested against JunOS v18.4R1
Examples
# Using merged
#
# Before state
# ------------
#
# vagrant@vsrx# show system syslog
#
# [edit]
# vagrant@vsrx# show routing-instances
# inst11 {
# description inst11;
# }
- name: Merge provided logging configuration into running configuration.
junipernetworks.junos.junos_logging_global:
config:
allow_duplicates: true
archive:
set: true
no_binary_data: true
files: 10
file_size: 65578
no_world_readable: true
console:
any:
level: "info"
authorization:
level: "any"
change_log:
level: "critical"
ftp:
level: "none"
files:
- name: "file101"
allow_duplicates: true
- name: "file102"
allow_duplicates: true
any:
level: "any"
structured_data:
set: true
- name: "file103"
archive:
set: true
no_binary_data: true
files: 10
file_size: 65578
no_world_readable: true
explicit_priority: true
match: "^set*"
match_strings:
- "^delete"
- "^prompt"
hosts:
- name: host111
exclude_hostname: true
allow_duplicates: true
any:
level: "any"
structured_data:
set: true
brief: true
facility_override: "ftp"
log_prefix: "field"
match: "^set*"
match_strings:
- "^delete"
- "^prompt"
port: 1231
routing_instance: "inst11"
source_address: "11.1.1.11"
routing_instance: "inst11"
log_rotate_frequency: 45
source_address: "33.33.33.33"
time_format:
millisecond: true
year: true
users:
- name: "user1"
allow_duplicates: true
- name: "user2"
allow_duplicates: true
any:
level: "any"
user:
level: info
state: merged
#
# -------------------------
# Module Execution Result
# -------------------------
# "after": {
# "allow_duplicates": true,
# "archive": {
# "file_size": 65578,
# "files": 10,
# "no_binary_data": true,
# "no_world_readable": true
# },
# "console": {
# "any": {
# "level": "info"
# },
# "authorization": {
# "level": "any"
# },
# "change_log": {
# "level": "critical"
# },
# "ftp": {
# "level": "none"
# }
# },
# "files": [
# {
# "allow_duplicates": true,
# "name": "file101"
# },
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "name": "file102",
# "structured_data": {
# "set": true
# }
# },
# {
# "archive": {
# "file_size": 65578,
# "files": 10,
# "no_binary_data": true,
# "no_world_readable": true
# },
# "explicit_priority": true,
# "match": "^set*",
# "match_strings": [
# "^delete",
# "^prompt"
# ],
# "name": "file103"
# }
# ],
# "hosts": [
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "exclude_hostname": true,
# "facility_override": "ftp",
# "log_prefix": "field",
# "match": "^set*",
# "match_strings": [
# "^delete",
# "^prompt"
# ],
# "name": "host111",
# "port": 1231,
# "routing_instance": "inst11",
# "source_address": "11.1.1.11",
# "structured_data": {
# "brief": true
# }
# }
# ],
# "log_rotate_frequency": 45,
# "routing_instance": "inst11",
# "source_address": "33.33.33.33",
# "time_format": {
# "millisecond": true,
# "year": true
# },
# "users": [
# {
# "allow_duplicates": true,
# "name": "user1"
# },
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "name": "user2",
# "user": {
# "level": "info"
# }
# }
# ]
# },
# "before": {},
# "changed": true,
# "commands": [
# "<nc:system xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">"
# "<nc:syslog><nc:allow-duplicates/><nc:archive><nc:files>10</nc:files>"
# "<nc:no-binary-data/><nc:size>65578</nc:size><nc:no-world-readable/></nc:archive>"
# "<nc:console><nc:name>change-log</nc:name><nc:critical/></nc:console><nc:console>"
# "<nc:name>any</nc:name><nc:info/></nc:console><nc:console><nc:name>authorization</nc:name>"
# "<nc:any/></nc:console><nc:console><nc:name>ftp</nc:name><nc:none/></nc:console><nc:file>"
# "<nc:name>file101</nc:name><nc:allow-duplicates/></nc:file><nc:file><nc:name>file102</nc:name>"
# "<nc:allow-duplicates/><nc:contents><nc:name>any</nc:name><nc:any/></nc:contents><nc:structured-data/>"
# "</nc:file><nc:file><nc:name>file103</nc:name><nc:archive><nc:files>10</nc:files><nc:no-binary-data/>"
# "<nc:size>65578</nc:size><nc:no-world-readable/></nc:archive><nc:explicit-priority/>"
# "<nc:match>^set*</nc:match><nc:match-strings>^delete</nc:match-strings>"
# "<nc:match-strings>^prompt</nc:match-strings></nc:file><nc:host><nc:name>host111</nc:name>"
# "<nc:allow-duplicates/><nc:contents><nc:name>any</nc:name><nc:any/></nc:contents>"
# "<nc:exclude-hostname/><nc:facility-override>ftp</nc:facility-override>"
# "<nc:log-prefix>field</nc:log-prefix><nc:match>^set*</nc:match><nc:match-strings>^delete</nc:match-strings>"
# "<nc:match-strings>^prompt</nc:match-strings><nc:port>1231</nc:port>"
# "<nc:routing-instance>inst11</nc:routing-instance><nc:source-address>11.1.1.11</nc:source-address>"
# "<nc:structured-data><nc:brief/></nc:structured-data></nc:host>"
# "<nc:log-rotate-frequency>45</nc:log-rotate-frequency><nc:routing-instance>inst11</nc:routing-instance>"
# "<nc:source-address>33.33.33.33</nc:source-address><nc:time-format><nc:millisecond/>"
# "<nc:year/></nc:time-format><nc:user><nc:name>user1</nc:name><nc:allow-duplicates/></nc:user>"
# "<nc:user><nc:name>user2</nc:name><nc:allow-duplicates/><nc:contents><nc:name>any</nc:name><nc:any/>"
# "</nc:contents><nc:contents><nc:name>user</nc:name><nc:info/></nc:contents></nc:user></nc:syslog></nc:system>"
# ]
# After state
# -----------
#
# vagrant@vsrx# show system syslog
# archive size 65578 files 10 no-world-readable no-binary-data;
# user user1 {
# allow-duplicates;
# }
# user user2 {
# any any;
# user info;
# allow-duplicates;
# }
# host host111 {
# any any;
# match "^set*";
# allow-duplicates;
# port 1231;
# facility-override ftp;
# log-prefix field;
# source-address 11.1.1.11;
# routing-instance inst11;
# exclude-hostname;
# match-strings [ "^delete" "^prompt" ];
# structured-data {
# brief;
# }
# }
# allow-duplicates;
# file file101 {
# allow-duplicates;
# }
# file file102 {
# any any;
# allow-duplicates;
# structured-data;
# }
# file file103 {
# match "^set*";
# archive size 65578 files 10 no-world-readable no-binary-data;
# explicit-priority;
# match-strings [ "^delete" "^prompt" ];
# }
# console {
# any info;
# authorization any;
# ftp none;
# change-log critical;
# }
# time-format year millisecond;
# source-address 33.33.33.33;
# routing-instance inst11;
# log-rotate-frequency 45;
# Using replaced
#
# Before state
# ------------
#
# vagrant@vsrx# show system syslog
# archive size 65578 files 10 no-world-readable no-binary-data;
# user user1 {
# allow-duplicates;
# }
# user user2 {
# any any;
# user info;
# allow-duplicates;
# }
# host host111 {
# any any;
# match "^set*";
# allow-duplicates;
# port 1231;
# facility-override ftp;
# log-prefix field;
# source-address 11.1.1.11;
# routing-instance inst11;
# exclude-hostname;
# match-strings [ "^delete" "^prompt" ];
# structured-data {
# brief;
# }
# }
# allow-duplicates;
# file file101 {
# allow-duplicates;
# }
# file file102 {
# any any;
# allow-duplicates;
# structured-data;
# }
# file file103 {
# match "^set*";
# archive size 65578 files 10 no-world-readable no-binary-data;
# explicit-priority;
# match-strings [ "^delete" "^prompt" ];
# }
# console {
# any info;
# authorization any;
# ftp none;
# change-log critical;
# }
# time-format year millisecond;
# source-address 33.33.33.33;
# routing-instance inst11;
# log-rotate-frequency 45;
- name: Replaced running logging global configuration with provided configuration
junipernetworks.junos.junos_logging_global:
config:
files:
- name: "file104"
allow_duplicates: true
- name: "file102"
allow_duplicates: true
any:
level: "any"
structured_data:
set: true
hosts:
- name: host222
exclude_hostname: true
allow_duplicates: true
any:
level: "any"
structured_data:
set: true
brief: true
facility_override: "ftp"
log_prefix: "field"
match: "^set*"
match_strings:
- "^delete"
- "^prompt"
port: 1231
routing_instance: "inst11"
source_address: "11.1.1.11"
users:
- name: "user1"
allow_duplicates: true
- name: "user2"
allow_duplicates: true
any:
level: "any"
user:
level: info
state: replaced
#
# -------------------------
# Module Execution Result
# -------------------------
# "after": {
# "files": [
# {
# "allow_duplicates": true,
# "name": "file104"
# },
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "name": "file102",
# "structured_data": {
# "set": true
# }
# }
# ],
# "hosts": [
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "exclude_hostname": true,
# "facility_override": "ftp",
# "log_prefix": "field",
# "match": "^set*",
# "match_strings": [
# "^delete",
# "^prompt"
# ],
# "name": "host222",
# "port": 1231,
# "routing_instance": "inst11",
# "source_address": "11.1.1.11",
# "structured_data": {
# "brief": true
# }
# }
# ],
# "users": [
# {
# "allow_duplicates": true,
# "name": "user1"
# },
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "name": "user2",
# "user": {
# "level": "info"
# }
# }
# ]
# },
# "before": {
# "allow_duplicates": true,
# "archive": {
# "file_size": 65578,
# "files": 10,
# "no_binary_data": true,
# "no_world_readable": true
# },
# "console": {
# "any": {
# "level": "info"
# },
# "authorization": {
# "level": "any"
# },
# "change_log": {
# "level": "critical"
# },
# "ftp": {
# "level": "none"
# }
# },
# "files": [
# {
# "allow_duplicates": true,
# "name": "file101"
# },
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "name": "file102",
# "structured_data": {
# "set": true
# }
# },
# {
# "archive": {
# "file_size": 65578,
# "files": 10,
# "no_binary_data": true,
# "no_world_readable": true
# },
# "explicit_priority": true,
# "match": "^set*",
# "match_strings": [
# "^delete",
# "^prompt"
# ],
# "name": "file103"
# }
# ],
# "hosts": [
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "exclude_hostname": true,
# "facility_override": "ftp",
# "log_prefix": "field",
# "match": "^set*",
# "match_strings": [
# "^delete",
# "^prompt"
# ],
# "name": "host111",
# "port": 1231,
# "routing_instance": "inst11",
# "source_address": "11.1.1.11",
# "structured_data": {
# "brief": true
# }
# }
# ],
# "log_rotate_frequency": 45,
# "routing_instance": "inst11",
# "source_address": "33.33.33.33",
# "time_format": {
# "millisecond": true,
# "year": true
# },
# "users": [
# {
# "allow_duplicates": true,
# "name": "user1"
# },
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "name": "user2",
# "user": {
# "level": "info"
# }
# }
# ]
# },
# "changed": true,
# "commands": [
# "<nc:system xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">"
# "<nc:syslog delete="delete"/><nc:syslog><nc:file><nc:name>file104</nc:name>"
# "<nc:allow-duplicates/></nc:file><nc:file><nc:name>file102</nc:name><nc:allow-duplicates/>"
# "<nc:contents><nc:name>any</nc:name><nc:any/></nc:contents><nc:structured-data/></nc:file>"
# "<nc:host><nc:name>host222</nc:name><nc:allow-duplicates/><nc:contents><nc:name>any</nc:name>"
# "<nc:any/></nc:contents><nc:exclude-hostname/><nc:facility-override>ftp</nc:facility-override>"
# "<nc:log-prefix>field</nc:log-prefix><nc:match>^set*</nc:match>"
# "<nc:match-strings>^delete</nc:match-strings>"
# "<nc:match-strings>^prompt</nc:match-strings><nc:port>1231</nc:port>"
# "<nc:routing-instance>inst11</nc:routing-instance><nc:source-address>11.1.1.11</nc:source-address>"
# "<nc:structured-data><nc:brief/></nc:structured-data></nc:host><nc:user><nc:name>user1</nc:name>"
# "<nc:allow-duplicates/></nc:user><nc:user><nc:name>user2</nc:name><nc:allow-duplicates/><nc:contents>"
# "<nc:name>any</nc:name><nc:any/></nc:contents>"
# "<nc:contents><nc:name>user</nc:name><nc:info/></nc:contents></nc:user></nc:syslog></nc:system>"
# ]
# After state
# -----------
#
# vagrant@vsrx# show system syslog
# user user1 {
# allow-duplicates;
# }
# user user2 {
# any any;
# user info;
# allow-duplicates;
# }
# host host222 {
# any any;
# match "^set*";
# allow-duplicates;
# port 1231;
# facility-override ftp;
# log-prefix field;
# source-address 11.1.1.11;
# routing-instance inst11;
# exclude-hostname;
# match-strings [ "^delete" "^prompt" ];
# structured-data {
# brief;
# }
# }
# file file104 {
# allow-duplicates;
# }
# file file102 {
# any any;
# allow-duplicates;
# structured-data;
# }
# Using overridden
#
# Before state
# ------------
#
# vagrant@vsrx# show system syslog
# archive size 65578 files 10 no-world-readable no-binary-data;
# user user1 {
# allow-duplicates;
# }
# user user2 {
# any any;
# user info;
# allow-duplicates;
# }
# host host111 {
# any any;
# match "^set*";
# allow-duplicates;
# port 1231;
# facility-override ftp;
# log-prefix field;
# source-address 11.1.1.11;
# routing-instance inst11;
# exclude-hostname;
# match-strings [ "^delete" "^prompt" ];
# structured-data {
# brief;
# }
# }
# allow-duplicates;
# file file101 {
# allow-duplicates;
# }
# file file102 {
# any any;
# allow-duplicates;
# structured-data;
# }
# file file103 {
# match "^set*";
# archive size 65578 files 10 no-world-readable no-binary-data;
# explicit-priority;
# match-strings [ "^delete" "^prompt" ];
# }
# console {
# any info;
# authorization any;
# ftp none;
# change-log critical;
# }
# time-format year millisecond;
# source-address 33.33.33.33;
# routing-instance inst11;
# log-rotate-frequency 45;
- name: Override running logging global configuration with provided configuration
junipernetworks.junos.junos_logging_global:
config:
files:
- name: "file104"
allow_duplicates: true
- name: "file102"
allow_duplicates: true
any:
level: "any"
structured_data:
set: true
hosts:
- name: host222
exclude_hostname: true
allow_duplicates: true
any:
level: "any"
structured_data:
set: true
brief: true
facility_override: "ftp"
log_prefix: "field"
match: "^set*"
match_strings:
- "^delete"
- "^prompt"
port: 1231
routing_instance: "inst11"
source_address: "11.1.1.11"
users:
- name: "user1"
allow_duplicates: true
- name: "user2"
allow_duplicates: true
any:
level: "any"
user:
level: info
state: overridden
#
# -------------------------
# Module Execution Result
# -------------------------
# "after": {
# "files": [
# {
# "allow_duplicates": true,
# "name": "file104"
# },
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "name": "file102",
# "structured_data": {
# "set": true
# }
# }
# ],
# "hosts": [
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "exclude_hostname": true,
# "facility_override": "ftp",
# "log_prefix": "field",
# "match": "^set*",
# "match_strings": [
# "^delete",
# "^prompt"
# ],
# "name": "host222",
# "port": 1231,
# "routing_instance": "inst11",
# "source_address": "11.1.1.11",
# "structured_data": {
# "brief": true
# }
# }
# ],
# "users": [
# {
# "allow_duplicates": true,
# "name": "user1"
# },
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "name": "user2",
# "user": {
# "level": "info"
# }
# }
# ]
# },
# "before": {
# "allow_duplicates": true,
# "archive": {
# "file_size": 65578,
# "files": 10,
# "no_binary_data": true,
# "no_world_readable": true
# },
# "console": {
# "any": {
# "level": "info"
# },
# "authorization": {
# "level": "any"
# },
# "change_log": {
# "level": "critical"
# },
# "ftp": {
# "level": "none"
# }
# },
# "files": [
# {
# "allow_duplicates": true,
# "name": "file101"
# },
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "name": "file102",
# "structured_data": {
# "set": true
# }
# },
# {
# "archive": {
# "file_size": 65578,
# "files": 10,
# "no_binary_data": true,
# "no_world_readable": true
# },
# "explicit_priority": true,
# "match": "^set*",
# "match_strings": [
# "^delete",
# "^prompt"
# ],
# "name": "file103"
# }
# ],
# "hosts": [
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "exclude_hostname": true,
# "facility_override": "ftp",
# "log_prefix": "field",
# "match": "^set*",
# "match_strings": [
# "^delete",
# "^prompt"
# ],
# "name": "host111",
# "port": 1231,
# "routing_instance": "inst11",
# "source_address": "11.1.1.11",
# "structured_data": {
# "brief": true
# }
# }
# ],
# "log_rotate_frequency": 45,
# "routing_instance": "inst11",
# "source_address": "33.33.33.33",
# "time_format": {
# "millisecond": true,
# "year": true
# },
# "users": [
# {
# "allow_duplicates": true,
# "name": "user1"
# },
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "name": "user2",
# "user": {
# "level": "info"
# }
# }
# ]
# },
# "changed": true,
# "commands": [
# "<nc:system xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">"
# "<nc:syslog delete="delete"/><nc:syslog><nc:file><nc:name>file104</nc:name>"
# "<nc:allow-duplicates/></nc:file><nc:file><nc:name>file102</nc:name><nc:allow-duplicates/>"
# "<nc:contents><nc:name>any</nc:name><nc:any/></nc:contents><nc:structured-data/></nc:file>"
# "<nc:host><nc:name>host222</nc:name><nc:allow-duplicates/><nc:contents><nc:name>any</nc:name>"
# "<nc:any/></nc:contents><nc:exclude-hostname/><nc:facility-override>ftp</nc:facility-override>"
# "<nc:log-prefix>field</nc:log-prefix><nc:match>^set*</nc:match>"
# "<nc:match-strings>^delete</nc:match-strings>"
# "<nc:match-strings>^prompt</nc:match-strings><nc:port>1231</nc:port>"
# "<nc:routing-instance>inst11</nc:routing-instance><nc:source-address>11.1.1.11</nc:source-address>"
# "<nc:structured-data><nc:brief/></nc:structured-data></nc:host><nc:user><nc:name>user1</nc:name>"
# "<nc:allow-duplicates/></nc:user><nc:user><nc:name>user2</nc:name><nc:allow-duplicates/><nc:contents>"
# "<nc:name>any</nc:name><nc:any/></nc:contents>"
# "<nc:contents><nc:name>user</nc:name><nc:info/></nc:contents></nc:user></nc:syslog></nc:system>"
# ]
# After state
# -----------
#
# vagrant@vsrx# show system syslog
# user user1 {
# allow-duplicates;
# }
# user user2 {
# any any;
# user info;
# allow-duplicates;
# }
# host host222 {
# any any;
# match "^set*";
# allow-duplicates;
# port 1231;
# facility-override ftp;
# log-prefix field;
# source-address 11.1.1.11;
# routing-instance inst11;
# exclude-hostname;
# match-strings [ "^delete" "^prompt" ];
# structured-data {
# brief;
# }
# }
# file file104 {
# allow-duplicates;
# }
# file file102 {
# any any;
# allow-duplicates;
# structured-data;
# }
# Using deleted
#
# Before state
# ------------
#
# vagrant@vsrx# show system syslog
# user user1 {
# allow-duplicates;
# }
# user user2 {
# any any;
# user info;
# allow-duplicates;
# }
# host host222 {
# any any;
# match "^set*";
# allow-duplicates;
# port 1231;
# facility-override ftp;
# log-prefix field;
# source-address 11.1.1.11;
# routing-instance inst11;
# exclude-hostname;
# match-strings [ "^delete" "^prompt" ];
# structured-data {
# brief;
# }
# }
# file file104 {
# allow-duplicates;
# }
# file file102 {
# any any;
# allow-duplicates;
# structured-data;
# }
- name: Delete running logging global configuration
junipernetworks.junos.junos_logging_global:
config:
state: deleted
#
# -------------------------
# Module Execution Result
# -------------------------
# "after": {},
# "before": {
# "files": [
# {
# "allow_duplicates": true,
# "name": "file104"
# },
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "name": "file102",
# "structured_data": {
# "set": true
# }
# }
# ],
# "hosts": [
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "exclude_hostname": true,
# "facility_override": "ftp",
# "log_prefix": "field",
# "match": "^set*",
# "match_strings": [
# "^delete",
# "^prompt"
# ],
# "name": "host222",
# "port": 1231,
# "routing_instance": "inst11",
# "source_address": "11.1.1.11",
# "structured_data": {
# "brief": true
# }
# }
# ],
# "users": [
# {
# "allow_duplicates": true,
# "name": "user1"
# },
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "name": "user2",
# "user": {
# "level": "info"
# }
# }
# ]
# },
# "changed": true,
# "commands": [
# "<nc:system xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">"
# "<nc:syslog delete="delete"/></nc:system>"
# ]
# After state
# -----------
#
# vagrant@vsrx# show system syslog
#
# [edit]
# Using gathered
#
# Before state
# ------------
#
# vagrant@vsrx# show system syslog
# user user1 {
# allow-duplicates;
# }
# user user2 {
# any any;
# user info;
# allow-duplicates;
# }
# host host222 {
# any any;
# match "^set*";
# allow-duplicates;
# port 1231;
# facility-override ftp;
# log-prefix field;
# source-address 11.1.1.11;
# routing-instance inst11;
# exclude-hostname;
# match-strings [ "^delete" "^prompt" ];
# structured-data {
# brief;
# }
# }
# file file104 {
# allow-duplicates;
# }
# file file102 {
# any any;
# allow-duplicates;
# structured-data;
# }
- name: Gather running logging global configuration
junipernetworks.junos.junos_logging_global:
state: gathered
#
# -------------------------
# Module Execution Result
# -------------------------
# "gathered": {
# "files": [
# {
# "allow_duplicates": true,
# "name": "file104"
# },
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "name": "file102",
# "structured_data": {
# "set": true
# }
# }
# ],
# "hosts": [
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "exclude_hostname": true,
# "facility_override": "ftp",
# "log_prefix": "field",
# "match": "^set*",
# "match_strings": [
# "^delete",
# "^prompt"
# ],
# "name": "host222",
# "port": 1231,
# "routing_instance": "inst11",
# "source_address": "11.1.1.11",
# "structured_data": {
# "brief": true
# }
# }
# ],
# "users": [
# {
# "allow_duplicates": true,
# "name": "user1"
# },
# {
# "allow_duplicates": true,
# "any": {
# "level": "any"
# },
# "name": "user2",
# "user": {
# "level": "info"
# }
# }
# ]
# },
# "changed": false,
# Using rendered
#
# Before state
# ------------
#
- name: Render xml for provided facts.
junipernetworks.junos.junos_logging_global:
config:
allow_duplicates: true
archive:
set: true
no_binary_data: true
files: 10
file_size: 65578
no_world_readable: true
console:
any:
level: "info"
authorization:
level: "any"
change_log:
level: "critical"
ftp:
level: "none"
files:
- name: "file101"
allow_duplicates: true
- name: "file102"
allow_duplicates: true
any:
level: "any"
structured_data:
set: true
- name: "file103"
archive:
set: true
no_binary_data: true
files: 10
file_size: 65578
no_world_readable: true
explicit_priority: true
match: "^set*"
match_strings:
- "^delete"
- "^prompt"
hosts:
- name: host111
exclude_hostname: true
allow_duplicates: true
any:
level: "any"
structured_data:
set: true
brief: true
facility_override: "ftp"
log_prefix: "field"
match: "^set*"
match_strings:
- "^delete"
- "^prompt"
port: 1231
routing_instance: "inst11"
source_address: "11.1.1.11"
routing_instance: "inst11"
log_rotate_frequency: 45
source_address: "33.33.33.33"
time_format:
millisecond: true
year: true
users:
- name: "user1"
allow_duplicates: true
- name: "user2"
allow_duplicates: true
any:
level: "any"
user:
level: info
state: rendered
#
# -------------------------
# Module Execution Result
# -------------------------
# "rendered": [
# "<nc:system xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">"
# "<nc:syslog><nc:allow-duplicates/><nc:archive><nc:files>10</nc:files>"
# "<nc:no-binary-data/><nc:size>65578</nc:size><nc:no-world-readable/></nc:archive>"
# "<nc:console><nc:name>change-log</nc:name><nc:critical/></nc:console><nc:console>"
# "<nc:name>any</nc:name><nc:info/></nc:console><nc:console><nc:name>authorization</nc:name>"
# "<nc:any/></nc:console><nc:console><nc:name>ftp</nc:name><nc:none/></nc:console><nc:file>"
# "<nc:name>file101</nc:name><nc:allow-duplicates/></nc:file><nc:file><nc:name>file102</nc:name>"
# "<nc:allow-duplicates/><nc:contents><nc:name>any</nc:name><nc:any/></nc:contents><nc:structured-data/>"
# "</nc:file><nc:file><nc:name>file103</nc:name><nc:archive><nc:files>10</nc:files><nc:no-binary-data/>"
# "<nc:size>65578</nc:size><nc:no-world-readable/></nc:archive><nc:explicit-priority/>"
# "<nc:match>^set*</nc:match><nc:match-strings>^delete</nc:match-strings>"
# "<nc:match-strings>^prompt</nc:match-strings></nc:file><nc:host><nc:name>host111</nc:name>"
# "<nc:allow-duplicates/><nc:contents><nc:name>any</nc:name><nc:any/></nc:contents>"
# "<nc:exclude-hostname/><nc:facility-override>ftp</nc:facility-override>"
# "<nc:log-prefix>field</nc:log-prefix><nc:match>^set*</nc:match><nc:match-strings>^delete</nc:match-strings>"
# "<nc:match-strings>^prompt</nc:match-strings><nc:port>1231</nc:port>"
# "<nc:routing-instance>inst11</nc:routing-instance><nc:source-address>11.1.1.11</nc:source-address>"
# "<nc:structured-data><nc:brief/></nc:structured-data></nc:host>"
# "<nc:log-rotate-frequency>45</nc:log-rotate-frequency><nc:routing-instance>inst11</nc:routing-instance>"
# "<nc:source-address>33.33.33.33</nc:source-address><nc:time-format><nc:millisecond/>"
# "<nc:year/></nc:time-format><nc:user><nc:name>user1</nc:name><nc:allow-duplicates/></nc:user>"
# "<nc:user><nc:name>user2</nc:name><nc:allow-duplicates/><nc:contents><nc:name>any</nc:name><nc:any/>"
# "</nc:contents><nc:contents><nc:name>user</nc:name><nc:info/></nc:contents></nc:user></nc:syslog></nc:system>"
# ]
# Using parsed
# parsed.cfg
# ------------
# <?xml version="1.0" encoding="UTF-8"?>
# <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f">
# <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC">
# <version>18.4R1-S2.4</version>
# <system xmlns="http://yang.juniper.net/junos-es/conf/system">
# <syslog>
# <user>
# <name>*</name>
# <contents>
# <name>any</name>
# <emergency/>
# </contents>
# </user>
# <file>
# <name>messages</name>
# <contents>
# <name>any</name>
# <any/>
# </contents>
# <contents>
# <name>authorization</name>
# <info/>
# </contents>
# </file>
# <file>
# <name>interactive-commands</name>
# <contents>
# <name>interactive-commands</name>
# <any/>
# </contents>
# </file>
# </syslog>
# </system>
# </configuration>
# </rpc-reply>
- name: Parse logging global running config
junipernetworks.junos.junos_routing_instances:
running_config: "{{ lookup('file', './parsed.cfg') }}"
state: parsed
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "parsed": {
# "files": [
# {
# "any": {
# "level": "any"
# },
# "authorization": {
# "level": "info"
# },
# "name": "messages"
# },
# {
# "interactive_commands": {
# "level": "any"
# },
# "name": "interactive-commands"
# }
# ],
# "users": [
# {
# "any": {
# "level": "emergency"
# },
# "name": "*"
# }
# ]
# }
#
#
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The resulting configuration model invocation. Returned: when changed Sample: |
|
The configuration prior to the model invocation. Returned: always Sample: |
|
The set of commands pushed to the remote device. Returned: always Sample: |