# An issue with community.proxysql.proxysql\_query\_rules module

**URL:** <https://forum.ansible.com/t/an-issue-with-community-proxysql-proxysql-query-rules-module/3805>\
**Category:** Get Help\
**Tags:** collections\
**Created:** [February 10, 2024, 5:59pm UTC](https://forum.ansible.com/t/an-issue-with-community-proxysql-proxysql-query-rules-module/3805 "2024-02-10T17:59:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![uder](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/uder/32/2258_2.png) [@uder](https://forum.ansible.com/u/uder)\
**Post date:** [February 10, 2024, 5:59pm UTC](https://forum.ansible.com/t/an-issue-with-community-proxysql-proxysql-query-rules-module/3805/1 "2024-02-10T17:59:43Z")

</div>

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:

```auto
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](https://docs.ansible.com/ansible/latest/collections/community/proxysql/proxysql_query_rules_module.html)

Ansible version: 2.13.4

---

<div class="post-metadata">

**Author:** ![atul\_mohan](https://avatars.discourse-cdn.com/v4/letter/a/f04885/32.png) [@atul\_mohan](https://forum.ansible.com/u/atul_mohan)\
**Post date:** [January 5, 2025, 10:51pm UTC](https://forum.ansible.com/t/an-issue-with-community-proxysql-proxysql-query-rules-module/3805/2 "2025-01-05T22:51:27Z")

</div>

```auto
---
- 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

```
