community.general.redis_info 模块 – 收集有关 Redis 服务器的信息
注意
此模块是 community.general 集合 (版本 10.1.0) 的一部分。
如果您使用的是 ansible
包,则可能已经安装了此集合。它不包含在 ansible-core
中。要检查是否已安装它,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.general
。您需要其他要求才能使用此模块,有关详细信息,请参阅 要求。
要在 playbook 中使用它,请指定:community.general.redis_info
。
community.general 0.2.0 中的新增功能
概要
收集有关 Redis 服务器的信息和统计数据。
要求
在执行此模块的主机上需要以下要求。
redis
certifi
参数
参数 |
注释 |
---|---|
根证书文件路径。如果未设置且 |
|
客户端证书文件路径。 |
|
客户端私钥文件路径。 |
|
指定运行数据库的目标主机。 默认值: |
|
指定用于身份验证的密码。 目标是 localhost 时通常不使用。 |
|
指定要连接的端口。 默认值: |
|
指定用于身份验证的用户。 需要 redis >= 3.4.0。 |
|
指定是否使用 TLS 进行连接。 选项
|
|
指定是否验证 TLS 证书。 仅应针对个人控制的站点或目标为 选项
|
属性
属性 |
支持 |
描述 |
---|---|---|
支持:完全支持 此操作不会修改状态。 |
可以在 |
|
支持: N/A 此操作不会修改状态。 |
在差异模式下,将返回有关已更改内容(或可能需要在 |
注释
注意
在远程主机上需要
redis
Python 包。您可以使用 pip (pip install redis
) 或包管理器安装它。有关该库的信息,请访问 https://github.com/andymccurdy/redis-py。
另请参见
另请参见
- community.general.redis
各种 redis 命令、副本和刷新。
示例
- name: Get server information
community.general.redis_info:
register: result
- name: Print server information
ansible.builtin.debug:
var: result.info
- name: Get server cluster information
community.general.redis_info:
cluster: true
register: result
- name: Print server cluster information
ansible.builtin.debug:
var: result.cluster_info
返回值
常见的返回值已在此处记录,以下是此模块特有的字段
Key |
描述 |
---|---|
默认的集群信息部分集合 https://redis.ac.cn/commands/cluster-info。 返回值:如果 示例: |
|
默认的服务器信息部分集合 https://redis.ac.cn/commands/info。 返回值:成功 示例: |