From d668281a6b6d6d7c45d8664c857df59c9ba0a661 Mon Sep 17 00:00:00 2001 From: bmildren Date: Tue, 19 Dec 2017 12:12:19 +0000 Subject: [PATCH] Added docs fragment for proxysql (#32502) * Added docs fragment for proxysql * Added formatting for option names, and bool types * Updated proxysql modules to use doc fragments --- .../proxysql/proxysql_backend_servers.py | 33 ++----------- .../proxysql/proxysql_global_variables.py | 33 ++----------- .../proxysql/proxysql_manage_config.py | 23 +-------- .../database/proxysql/proxysql_mysql_users.py | 37 ++------------ .../database/proxysql/proxysql_query_rules.py | 33 ++----------- .../proxysql_replication_hostgroups.py | 33 ++----------- .../database/proxysql/proxysql_scheduler.py | 33 ++----------- .../utils/module_docs_fragments/proxysql.py | 48 +++++++++++++++++++ 8 files changed, 70 insertions(+), 203 deletions(-) create mode 100644 lib/ansible/utils/module_docs_fragments/proxysql.py diff --git a/lib/ansible/modules/database/proxysql/proxysql_backend_servers.py b/lib/ansible/modules/database/proxysql/proxysql_backend_servers.py index 66920504605..6135179ab57 100644 --- a/lib/ansible/modules/database/proxysql/proxysql_backend_servers.py +++ b/lib/ansible/modules/database/proxysql/proxysql_backend_servers.py @@ -85,36 +85,9 @@ options: - When C(present) - adds the host, when C(absent) - removes the host. choices: [ "present", "absent" ] default: present - save_to_disk: - description: - - Save mysql host config to sqlite db on disk to persist the - configuration. - default: True - load_to_runtime: - description: - - Dynamically load mysql host config to runtime memory. - default: True - login_user: - description: - - The username used to authenticate to ProxySQL admin interface. - default: None - login_password: - description: - - The password used to authenticate to ProxySQL admin interface. - default: None - login_host: - description: - - The host used to connect to ProxySQL admin interface. - default: '127.0.0.1' - login_port: - description: - - The port used to connect to ProxySQL admin interface. - default: 6032 - config_file: - description: - - Specify a config file from which login_user and login_password are to - be read. - default: '' +extends_documentation_fragment: + - proxysql.managing_config + - proxysql.connectivity ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/database/proxysql/proxysql_global_variables.py b/lib/ansible/modules/database/proxysql/proxysql_global_variables.py index 7f2e836705e..7b5b319d852 100644 --- a/lib/ansible/modules/database/proxysql/proxysql_global_variables.py +++ b/lib/ansible/modules/database/proxysql/proxysql_global_variables.py @@ -25,36 +25,9 @@ options: description: - Defines a value the variable specified using I(variable) should be set to. - save_to_disk: - description: - - Save mysql host config to sqlite db on disk to persist the - configuration. - default: True - load_to_runtime: - description: - - Dynamically load mysql host config to runtime memory. - default: True - login_user: - description: - - The username used to authenticate to ProxySQL admin interface. - default: None - login_password: - description: - - The password used to authenticate to ProxySQL admin interface. - default: None - login_host: - description: - - The host used to connect to ProxySQL admin interface. - default: '127.0.0.1' - login_port: - description: - - The port used to connect to ProxySQL admin interface. - default: 6032 - config_file: - description: - - Specify a config file from which login_user and login_password are to - be read. - default: '' +extends_documentation_fragment: + - proxysql.managing_config + - proxysql.connectivity ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/database/proxysql/proxysql_manage_config.py b/lib/ansible/modules/database/proxysql/proxysql_manage_config.py index b0cdd01f7e0..8f5395e740f 100644 --- a/lib/ansible/modules/database/proxysql/proxysql_manage_config.py +++ b/lib/ansible/modules/database/proxysql/proxysql_manage_config.py @@ -52,27 +52,8 @@ options: config file. choices: [ "MEMORY", "DISK", "RUNTIME", "CONFIG" ] required: True - login_user: - description: - - The username used to authenticate to ProxySQL admin interface. - default: None - login_password: - description: - - The password used to authenticate to ProxySQL admin interface. - default: None - login_host: - description: - - The host used to connect to ProxySQL admin interface. - default: '127.0.0.1' - login_port: - description: - - The port used to connect to ProxySQL admin interface. - default: 6032 - config_file: - description: - - Specify a config file from which login_user and login_password are to - be read. - default: '' +extends_documentation_fragment: + - proxysql.connectivity ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/database/proxysql/proxysql_mysql_users.py b/lib/ansible/modules/database/proxysql/proxysql_mysql_users.py index e434ee645c5..7d42fc52049 100644 --- a/lib/ansible/modules/database/proxysql/proxysql_mysql_users.py +++ b/lib/ansible/modules/database/proxysql/proxysql_mysql_users.py @@ -47,8 +47,8 @@ options: to ProxySQL (thus a "frontend" user), transactions started within a hostgroup will remain within that hostgroup regardless of any other rules. - If omitted the proxysql database default for I(transaction_persistent) is - C(False). + If omitted the proxysql database default for I(transaction_persistent) + is C(False). fast_forward: description: - If I(fast_forward) is set to C(True), I(fast_forward) will bypass the @@ -75,36 +75,9 @@ options: - When C(present) - adds the user, when C(absent) - removes the user. choices: [ "present", "absent" ] default: present - save_to_disk: - description: - - Save mysql host config to sqlite db on disk to persist the - configuration. - default: True - load_to_runtime: - description: - - Dynamically load mysql host config to runtime memory. - default: True - login_user: - description: - - The username used to authenticate to ProxySQL admin interface. - default: None - login_password: - description: - - The password used to authenticate to ProxySQL admin interface. - default: None - login_host: - description: - - The host used to connect to ProxySQL admin interface. - default: '127.0.0.1' - login_port: - description: - - The port used to connect to ProxySQL admin interface. - default: 6032 - config_file: - description: - - Specify a config file from which login_user and login_password are to - be read. - default: '' +extends_documentation_fragment: + - proxysql.managing_config + - proxysql.connectivity ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/database/proxysql/proxysql_query_rules.py b/lib/ansible/modules/database/proxysql/proxysql_query_rules.py index fc06266fd44..44af55f2a1c 100644 --- a/lib/ansible/modules/database/proxysql/proxysql_query_rules.py +++ b/lib/ansible/modules/database/proxysql/proxysql_query_rules.py @@ -134,36 +134,9 @@ options: however if you need this behaviour and you're not concerned about the schedules deleted, you can set I(force_delete) to C(True). default: False - save_to_disk: - description: - - Save mysql host config to sqlite db on disk to persist the - configuration. - default: True - load_to_runtime: - description: - - Dynamically load mysql host config to runtime memory. - default: True - login_user: - description: - - The username used to authenticate to ProxySQL admin interface. - default: None - login_password: - description: - - The password used to authenticate to ProxySQL admin interface. - default: None - login_host: - description: - - The host used to connect to ProxySQL admin interface. - default: '127.0.0.1' - login_port: - description: - - The port used to connect to ProxySQL admin interface. - default: 6032 - config_file: - description: - - Specify a config file from which login_user and login_password are to - be read. - default: '' +extends_documentation_fragment: + - proxysql.managing_config + - proxysql.connectivity ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/database/proxysql/proxysql_replication_hostgroups.py b/lib/ansible/modules/database/proxysql/proxysql_replication_hostgroups.py index e4238254334..3760dce0be4 100644 --- a/lib/ansible/modules/database/proxysql/proxysql_replication_hostgroups.py +++ b/lib/ansible/modules/database/proxysql/proxysql_replication_hostgroups.py @@ -37,36 +37,9 @@ options: removes the replication hostgroup. choices: [ "present", "absent" ] default: present - save_to_disk: - description: - - Save mysql host config to sqlite db on disk to persist the - configuration. - default: True - load_to_runtime: - description: - - Dynamically load mysql host config to runtime memory. - default: True - login_user: - description: - - The username used to authenticate to ProxySQL admin interface. - default: None - login_password: - description: - - The password used to authenticate to ProxySQL admin interface. - default: None - login_host: - description: - - The host used to connect to ProxySQL admin interface. - default: '127.0.0.1' - login_port: - description: - - The port used to connect to ProxySQL admin interface. - default: 6032 - config_file: - description: - - Specify a config file from which login_user and login_password are to - be read. - default: '' +extends_documentation_fragment: + - proxysql.managing_config + - proxysql.connectivity ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/database/proxysql/proxysql_scheduler.py b/lib/ansible/modules/database/proxysql/proxysql_scheduler.py index 390dccc9e18..faa63ef8ae4 100644 --- a/lib/ansible/modules/database/proxysql/proxysql_scheduler.py +++ b/lib/ansible/modules/database/proxysql/proxysql_scheduler.py @@ -60,36 +60,9 @@ options: however if you need this behaviour and you're not concerned about the schedules deleted, you can set I(force_delete) to C(True). default: False - save_to_disk: - description: - - Save mysql host config to sqlite db on disk to persist the - configuration. - default: True - load_to_runtime: - description: - - Dynamically load mysql host config to runtime memory. - default: True - login_user: - description: - - The username used to authenticate to ProxySQL admin interface. - default: None - login_password: - description: - - The password used to authenticate to ProxySQL admin interface. - default: None - login_host: - description: - - The host used to connect to ProxySQL admin interface. - default: '127.0.0.1' - login_port: - description: - - The port used to connect to ProxySQL admin interface. - default: 6032 - config_file: - description: - - Specify a config file from which login_user and login_password are to - be read. - default: '' +extends_documentation_fragment: + - proxysql.managing_config + - proxysql.connectivity ''' EXAMPLES = ''' diff --git a/lib/ansible/utils/module_docs_fragments/proxysql.py b/lib/ansible/utils/module_docs_fragments/proxysql.py new file mode 100644 index 00000000000..033cc1ec7c3 --- /dev/null +++ b/lib/ansible/utils/module_docs_fragments/proxysql.py @@ -0,0 +1,48 @@ +# Copyright: (c) 2017, Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt + + +class ModuleDocFragment(object): + + # Documentation fragment for ProxySQL connectivity + CONNECTIVITY = ''' +options: + login_user: + description: + - The username used to authenticate to ProxySQL admin interface. + default: None + login_password: + description: + - The password used to authenticate to ProxySQL admin interface. + default: None + login_host: + description: + - The host used to connect to ProxySQL admin interface. + default: '127.0.0.1' + login_port: + description: + - The port used to connect to ProxySQL admin interface. + default: 6032 + config_file: + description: + - Specify a config file from which I(login_user) and I(login_password) + are to be read. + default: '' +requirements: + - MySQLdb +''' + + # Documentation fragment for managing ProxySQL configuration + MANAGING_CONFIG = ''' +options: + save_to_disk: + description: + - Save config to sqlite db on disk to persist the configuration. + type: bool + default: True + load_to_runtime: + description: + - Dynamically load config to runtime memory. + type: bool + default: True +'''