community.proxysql.proxysql_scheduler 模块 – 在 ProxySQL 管理界面添加或删除调度
注意
此模块是 community.proxysql 集合 (版本 1.6.0) 的一部分。
如果您正在使用 ansible
软件包,则可能已经安装了此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.proxysql
。您需要其他要求才能使用此模块,有关详细信息,请参阅 要求。
要在 playbook 中使用它,请指定:community.proxysql.proxysql_scheduler
。
概要
community.proxysql.proxysql_scheduler 模块使用 ProxySQL 管理界面添加或删除调度。
要求
执行此模块的主机需要以下要求。
PyMySQL
mysqlclient
参数
参数 |
注释 |
---|---|
将 *active* 设置为 选项
|
|
可以传递给作业的参数。 |
|
可以传递给作业的参数。 |
|
可以传递给作业的参数。 |
|
可以传递给作业的参数。 |
|
可以传递给作业的参数。 |
|
可用于用户定义的任何用途的文本字段。 |
|
指定一个配置文件,从中读取 *login_user* 和 *login_password*。 默认值: |
|
要执行的可执行文件的完整路径。 |
|
默认情况下,我们避免在单个批次中删除多个调度,但是如果您需要此行为并且不关心已删除的调度,则可以将 *force_delete* 设置为 选项
|
|
作业启动的频率(以毫秒为单位)。*interval_ms* 的最小值为 100 毫秒。 默认值: |
|
动态将配置加载到运行时内存。 选项
|
|
用于连接到 ProxySQL 管理界面的主机。 默认值: |
|
用于向 ProxySQL 管理界面进行身份验证的密码。 |
|
用于连接到 ProxySQL 管理界面的端口。 默认值: |
|
用于连接到 ProxySQL 管理界面的套接字。 |
|
用于向 ProxySQL 管理界面进行身份验证的用户名。 |
|
将配置保存到磁盘上的 sqlite 数据库以持久化配置。 选项
|
|
当 选项
|
备注
注意
支持
check_mode
。
示例
---
# This example adds a schedule, it saves the scheduler config to disk, but
# avoids loading the scheduler config to runtime (this might be because
# several servers are being added and the user wants to push the config to
# runtime in a single batch using the community.general.proxysql_manage_config
# module). It uses supplied credentials to connect to the proxysql admin
# interface.
- name: Add a schedule
community.proxysql.proxysql_scheduler:
login_user: 'admin'
login_password: 'admin'
interval_ms: 1000
filename: "/opt/maintenance.py"
state: present
load_to_runtime: false
# This example removes a schedule, saves the scheduler config to disk, and
# dynamically loads the scheduler config to runtime. It uses credentials
# in a supplied config file to connect to the proxysql admin interface.
- name: Remove a schedule
community.proxysql.proxysql_scheduler:
config_file: '~/proxysql.cnf'
filename: "/opt/old_script.py"
state: absent
返回值
常用返回值已在 此处 记录,以下是此模块特有的字段
键 |
描述 |
---|---|
从 ProxySQL 修改或删除的调度。 返回:在创建/更新时将返回新修改的调度,在删除时将返回已删除的记录。 示例: |