uder
(Pavel Salnikov)
February 10, 2024, 5:59pm
1
Hello everyone! Does someone uses Ansible for proxysql management? I I have an issue with community.proxysql.proxysql_query_rules module. The module ignores proxy_port, match_pattern and some other fields.
Example output from module:
changed: [some_host_name] => (item={'rule_id': '54', 'active': '1', 'flagIN': '0', 'proxy_port': '6035', 'match_pattern': '(^\\s*\\/\\*.*\\*\\/\\s*|^\\s*)USE.*', 'negate_match_pattern': '0', 're_modifiers': 'CASELESS', 'destination_hostgroup': '11', 'apply': '1', 'comment': 'RO query rules for developers'})
Looks like, the module recieves the correct data. But the fileds are not changed in resulting rule in actual proxysql condfiguration.
Does someone faced a similar issue? Could you help to debug the issue?
The module is a part of community.proxysql collection.
https://docs.ansible.com/ansible/latest/collections/community/proxysql/proxysql_query_rules_module.html
Ansible version: 2.13.4
---
- name: Configure ProxySQL query rules
hosts: some_host_name
gather_facts: no
tasks:
- name: Apply ProxySQL query rule
community.proxysql.proxysql_query_rules:
config_file: "/path/to/proxysql.cnf"
login_user: "admin"
login_password: "admin_password"
rule_id: "54"
active: "1"
flagIN: "0"
proxy_port: "6035"
match_pattern: "(^\\s*\\/\\*.*\\*\\/\\s*|^\\s*)USE.*"
negate_match_pattern: "0"
re_modifiers: "CASELESS"
destination_hostgroup: "11"
apply: "1"
comment: "RO query rules for developers"
state: "present"
load_to_runtime: true
save_to_disk: true
register: result
failed_when: result.msg is defined and 'failed' in result.msg
- name: Debug output
debug:
var: result
- name: Verify changes in ProxySQL
command: mysql -u admin -padmin_password -h 127.0.0.1 -P 6032 -e "SELECT * FROM mysql_query_rules WHERE rule_id = '54';"
register: verify_output
changed_when: false
- name: Display verification result
debug:
var: verify_output.stdout_lines