Manage logging configuration on Junos devices.
Version added: 2.4.0
- This module manages logging configuration on devices running Junos.
The below requirements are needed on the host that executes this module.
- ncclient (>=v0.6.4)
- xmltodict (>=0.12.0)
Note
- This module requires the netconf system service be enabled on the device being managed.
- This module works with connection
netconf
. - See the Junos OS Platform Options.
- Tested against JunOS v18.4R1
# 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": "*"
# }
# ]
# }
#
#
Common return values are documented here, the following are the fields unique to this module:
- Rohit Thakur (@rohitthakur2590)