community.general.proxysql_scheduler (0.2.1) — module

Adds or removes schedules from proxysql admin interface.

Authors: Ben Mildren (@bmildren)

Install collection

Install with ansible-galaxy collection install community.general:==0.2.1


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.2.1

Description

The M(proxysql_scheduler) module adds or removes schedules using the proxysql admin interface.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
---
# 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 M(proxysql_manage_config) module).  It
# uses supplied credentials to connect to the proxysql admin interface.

- name: Add a schedule
  proxysql_scheduler:
    login_user: 'admin'
    login_password: 'admin'
    interval_ms: 1000
    filename: "/opt/maintenance.py"
    state: present
    load_to_runtime: False
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  proxysql_scheduler:
    config_file: '~/proxysql.cnf'
    filename: "/opt/old_script.py"
    state: absent

Inputs

    
arg1:
    description:
    - Argument that can be passed to the job.

arg2:
    description:
    - Argument that can be passed to the job.

arg3:
    description:
    - Argument that can be passed to the job.

arg4:
    description:
    - Argument that can be passed to the job.

arg5:
    description:
    - Argument that can be passed to the job.

state:
    choices:
    - present
    - absent
    default: present
    description:
    - When C(present) - adds the schedule, when C(absent) - removes the schedule.

active:
    default: true
    description:
    - A schedule with I(active) set to C(False) will be tracked in the database, but will
      be never loaded in the in-memory data structures.
    type: bool

comment:
    description:
    - Text field that can be used for any purposed defined by the user.

filename:
    description:
    - Full path of the executable to be executed.
    required: true

login_host:
    default: 127.0.0.1
    description:
    - The host used to connect to ProxySQL admin interface.
    type: str

login_port:
    default: 6032
    description:
    - The port used to connect to ProxySQL admin interface.
    type: int

login_user:
    description:
    - The username used to authenticate to ProxySQL admin interface.
    type: str

config_file:
    default: ''
    description:
    - Specify a config file from which I(login_user) and I(login_password) are to be read.
    type: path

interval_ms:
    default: 10000
    description:
    - How often (in millisecond) the job will be started. The minimum value for I(interval_ms)
      is 100 milliseconds.

force_delete:
    default: false
    description:
    - By default we avoid deleting more than one schedule in a single batch, however if
      you need this behaviour and you're not concerned about the schedules deleted, you
      can set I(force_delete) to C(True).
    type: bool

save_to_disk:
    default: 'yes'
    description:
    - Save config to sqlite db on disk to persist the configuration.
    type: bool

login_password:
    description:
    - The password used to authenticate to ProxySQL admin interface.
    type: str

load_to_runtime:
    default: 'yes'
    description:
    - Dynamically load config to runtime memory.
    type: bool

Outputs

stdout:
  description: The schedule modified or removed from proxysql
  returned: On create/update will return the newly modified schedule, on delete it
    will return the deleted record.
  sample:
    changed: true
    filename: /opt/test.py
    msg: Added schedule to scheduler
    schedules:
    - active: '1'
      arg1: null
      arg2: null
      arg3: null
      arg4: null
      arg5: null
      comment: ''
      filename: /opt/test.py
      id: '1'
      interval_ms: '10000'
    state: present
  type: dict