junipernetworks.junos.junos_logging_global 模块 – 管理 Junos 设备上的日志配置。

注意

此模块是 junipernetworks.junos 集合(版本 9.1.0)的一部分。

如果您正在使用 ansible 包,则可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用:ansible-galaxy collection install junipernetworks.junos。您需要其他要求才能使用此模块,请参阅 要求 以了解详细信息。

要在 playbook 中使用它,请指定:junipernetworks.junos.junos_logging_global

junipernetworks.junos 2.4.0 中的新功能

概要

  • 此模块管理运行 Junos 的设备上的日志配置。

要求

执行此模块的主机需要满足以下要求。

  • ncclient (>=v0.6.4)

  • xmltodict (>=0.12.0)

参数

参数

注释

config

字典

日志配置的字典。

allow_duplicates

布尔值

不要为所有目标抑制重复消息。

选择

  • false

  • true

archive

字典

指定归档文件信息。

binary_data

布尔值

将文件标记为包含二进制数据。

选择

  • false

  • true

file_size

字符串

要归档的文件大小(65536..1073741824 字节)。

files

整数

指定要归档的文件数量(1..1000)。

no_binary_data

布尔值

不要将文件标记为包含二进制数据。

选择

  • false

  • true

no_world_readable

布尔值

不允许任何用户读取日志文件。

选择

  • false

  • true

set

布尔值

设置归档文件信息。

选择

  • false

  • true

world_readable

布尔值

允许任何用户读取日志文件。

选择

  • false

  • true

console

字典

设置控制台日志记录参数。

any

字典

设置所有设备。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

authorization

字典

指定授权系统。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

change_log

字典

指定配置更改日志。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

conflict_log

字典

指定配置冲突日志。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

daemon

字典

指定各种系统进程。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

dfc

字典

指定动态流捕获。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

external

字典

指定本地外部应用程序。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

firewall

字典

指定防火墙过滤系统。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

ftp

字典

指定 FTP 进程。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

interactive_commands

字典

指定 UI 执行的命令。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

kernel

字典

指定内核特定的日志记录。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

ntp

字典

指定 NTP 进程特定的日志记录。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

pfe

字典

指定数据包转发引擎特定的日志记录。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

security

字典

指定与安全相关的日志记录。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

user

字典

指定用户特定的日志记录。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

files

列表 / elements=字典

指定文件日志记录。

allow_duplicates

布尔值

不要为所有目标抑制重复消息。

选择

  • false

  • true

any

字典

设置所有设备。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

archive

字典

指定归档文件信息。

archive_sites

列表 / elements=字符串

指定用于接收归档设施的主 URL 和故障转移 URL。

binary_data

布尔值

将文件标记为包含二进制数据。

选择

  • false

  • true

file_size

字符串

要归档的文件大小(65536..1073741824 字节)。

files

整数

指定要归档的文件数量(1..1000)。

no_binary_data

布尔值

不要将文件标记为包含二进制数据。

选择

  • false

  • true

no_world_readable

布尔值

不允许任何用户读取日志文件。

选择

  • false

  • true

set

布尔值

设置归档文件信息。

选择

  • false

  • true

start_time

字符串

指定文件传输的开始时间(yyyy-mm-dd.hh:mm)。

transfer_interval

整数

指定将文件传输到归档站点的频率(5..2880 分钟)。

world_readable

布尔值

允许任何用户读取日志文件。

选择

  • false

  • true

authorization

字典

指定授权系统。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

change_log

字典

指定配置更改日志。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

conflict_log

字典

指定配置冲突日志。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

daemon

字典

指定各种系统进程。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

dfc

字典

指定动态流捕获。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

explicit_priority

布尔值

在消息中包含优先级和设施。

选择

  • false

  • true

external

字典

指定本地外部应用程序。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

firewall

字典

指定防火墙过滤系统。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

ftp

字典

指定 FTP 进程。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

interactive_commands

字典

指定 UI 执行的命令。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

kernel

字典

指定内核特定的日志记录。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

match

字符串

指定要记录的行的正则表达式。

match_strings

列表 / elements=字符串

指定要记录的行的匹配字符串。

name

字符串

指定用于记录数据的文件名。

ntp

字典

指定 NTP 进程特定的日志记录。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

pfe

字典

指定数据包转发引擎特定的日志记录。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

security

字典

指定与安全相关的日志记录。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

structured_data

字典

以结构化格式指定日志系统消息。

brief

布尔值

从记录的消息末尾省略英语文本。

选择

  • false

  • true

set

布尔值

以结构化格式设置日志系统消息。

选择

  • false

  • true

user

字典

指定用户特定的日志记录。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

hosts

列表 / elements=字典

指定要通知的主机。

allow_duplicates

布尔值

不要为所有目标抑制重复消息。

选择

  • false

  • true

any

字典

设置所有设备。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

authorization

字典

指定授权系统。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

change_log

字典

指定配置更改日志。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

conflict_log

字典

指定配置冲突日志。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

daemon

字典

指定各种系统进程。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

dfc

字典

指定动态流捕获。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

exclude_hostname

布尔值

在消息中指定排除主机名字段。

选择

  • false

  • true

explicit_priority

布尔值

在消息中包含优先级和设施。

选择

  • false

  • true

external

字典

指定本地外部应用程序。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

facility_override

字符串

指定用于记录到远程主机的备用设施。

firewall

字典

指定防火墙过滤系统。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

ftp

字典

指定 FTP 进程。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

interactive_commands

字典

指定 UI 执行的命令。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

kernel

字典

指定内核特定的日志记录。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

log_prefix

字符串

此主机的所有日志记录的前缀。

match

字符串

指定要记录的行的正则表达式。

match_strings

列表 / elements=字符串

指定要记录的行的匹配字符串。

name

字符串

指定主机名。

ntp

字典

指定 NTP 进程特定的日志记录。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

pfe

字典

指定数据包转发引擎特定的日志记录。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

port

整数

指定端口号。

routing_instance

字符串

指定路由实例。

security

字典

指定与安全相关的日志记录。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

source_address

字符串

将地址指定为源地址。

structured_data

字典

以结构化格式指定日志系统消息。

brief

布尔值

从记录的消息末尾省略英语文本。

选择

  • false

  • true

set

布尔值

以结构化格式设置日志系统消息。

选择

  • false

  • true

user

字典

指定用户特定的日志记录。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

log_rotate_frequency

整数

指定日志轮换频率(1..59 分钟)。

routing_instance

字符串

指定路由实例。

server

字典

指定 syslog 服务器日志记录。

routing_instance

字典

在路由实例中启用/禁用 syslog 服务器。

all

布尔值

启用/禁用所有路由实例。

选择

  • false

  • true

default

布尔值

启用/禁用默认路由实例。

选择

  • false

  • true

routing_instances

列表 / elements=字典

指定路由实例。

disable

布尔值

在此路由实例中禁用 syslog 服务器。

选择

  • false

  • true

name

字符串

指定路由实例名称。

set

布尔值

启用 syslog 服务器。

选择

  • false

  • true

source_address

字符串

将地址指定为源地址。

time_format

字典

指定要包含在系统日志时间戳中的其他信息。

millisecond

布尔值

在时间戳中包含毫秒。

选择

  • false

  • true

set

布尔值

设置 time-format

选择

  • false

  • true

year

布尔值

在时间戳中包含年份。

选择

  • false

  • true

users

列表 / elements=字典

指定用户日志记录

allow_duplicates

布尔值

不要为所有目标抑制重复消息。

选择

  • false

  • true

any

字典

设置所有设备。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

authorization

字典

指定授权系统。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

change_log

字典

指定配置更改日志。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

conflict_log

字典

指定配置冲突日志。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

daemon

字典

指定各种系统进程。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

dfc

字典

指定动态流捕获。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

external

字典

指定本地外部应用程序。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

firewall

字典

指定防火墙过滤系统。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

ftp

字典

指定 FTP 进程。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

interactive_commands

字典

指定 UI 执行的命令。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

kernel

字典

指定内核特定的日志记录。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

match

字符串

指定要记录的行的正则表达式。

match_strings

列表 / elements=字符串

指定要记录的行的匹配字符串。

name

字符串

指定用户名。

ntp

字典

指定 NTP 进程特定的日志记录。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

pfe

字典

指定数据包转发引擎特定的日志记录。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

security

字典

指定与安全相关的日志记录。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

user

字典

指定用户特定的日志记录。

level

字符串 / 必需

设置严重性日志记录级别。

选择

  • "alert"

  • "any"

  • "critical"

  • "emergency"

  • "error"

  • "info"

  • "none"

  • "notice"

  • "warning"

running_config

字符串

此选项仅与状态 parsed 一起使用。

此选项的值应是通过执行命令 show system syslog 从 Junos 设备收到的输出。

状态 parsedrunning_config 选项读取配置,并根据资源模块的 argspec 将其转换为 Ansible 结构化数据,然后该值将在结果中的 parsed 键中返回。

state

字符串

配置应保留的状态。

有关更多详细信息,请参阅示例。

选择

  • "merged" ← (默认)

  • "replaced"

  • "deleted"

  • "overridden"

  • "parsed"

  • "gathered"

  • "rendered"

备注

注意

  • 此模块需要在被管理的设备上启用 netconf 系统服务。

  • 此模块使用 netconf 连接。

  • 请参阅 Junos OS 平台选项

  • 已在 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": "*"
#             }
#         ]
#     }
#
#

返回值

常用的返回值记录在这里,以下是此模块独有的字段。

描述

after

字典

最终的配置模型调用。

返回: 当发生更改时

示例: "返回的配置将始终与上面的参数格式相同。\n"

before

字典

模型调用之前的配置。

返回: 总是

示例: "返回的配置将始终与上面的参数格式相同。\n"

commands

列表 / elements=字符串

推送到远程设备的命令集。

返回: 总是

示例: ["<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>\"", "xml 2", "xml 3"]

作者

  • Rohit Thakur (@rohitthakur2590)