I am using below block to fetch mysql variables.
- name: Check for wsrep_cluster_status setting
mysql_variables:
login_user: '{{ mysql_root_user }}'
login_password: '{{ mysql_root_pwd }}'
variable: wsrep_ready
register: v_wcs
become_user: mysql
When I execute playbook, it gives be following message:
TASK [mysql-post-patch-validation : Check for wsrep_cluster_status setting] *****************************************************************************************************************
task path: /ansible/MYSQL_PROD_PLAYBOOKS/roles/mysql-post-patch-validation/tasks/main.yml:21
fatal: [dehammy199.int.kn]: **FAILED! => {"changed": false, "msg": "Variable not available \"wsrep_ready\""}**
PLAY RECAP **********************************************************************************************************************************************************************************
dehammy199.int.kn : ok=5 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
However, when I use the same module to fetch other variable values not related to wsrep, for example wait_timeout, I get the results:
- name: Check for wait_timeout setting
mysql_variables:
login_user: '{{ mysql_root_user }}'
login_password: '{{ mysql_root_pwd }}'
variable: wait_timeout
register: v_wcs_2
become_user: mysql
TASK [mysql-post-patch-validation : Check for wait_timeout setting] *************************************************************************************************************************
task path: /ansible/MYSQL_PROD_PLAYBOOKS/roles/mysql-post-patch-validation/tasks/main.yml:21
ok: [dehammy199.int.kn] => {"changed": false, "msg": "350"}
Is there a workaround for me to fetch wsrep related values using Ansible modules?
Yes, I can query the variable from mysql. (End result is same in all the cases.)
root@localhost [(none)]> show global status like 'wsrep_ready';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wsrep_ready | ON |
+---------------+-------+
1 row in set (0.00 sec)
root@localhost [(none)]>