Ansible mysql\u variables模块是否有办法设置变量持久性?
我有一本关于这项任务的剧本Ansible mysql\u variables模块是否有办法设置变量持久性?,mysql,variables,ansible,mysql-variables,Mysql,Variables,Ansible,Mysql Variables,我有一本关于这项任务的剧本 --- - name: Set mysql_variable mysql_variables: variable: mysql_variable value: 2000 - name: Reload MySQL service: name: mysql state: restarted enabled: yes 第一个任务将变量设置为所需状态,我可以验证。。但它不是持久的。当第二个任务重新加载mysql服务时,变量被设
---
- name: Set mysql_variable
mysql_variables:
variable: mysql_variable
value: 2000
- name: Reload MySQL
service:
name: mysql
state: restarted
enabled: yes
第一个任务将变量设置为所需状态,我可以验证。。但它不是持久的。当第二个任务重新加载mysql服务时,变量被设置为默认值
如何在目标节点上使用Ansible设置此变量persistent 您正在尝试设置哪个变量?在不使用ansible的情况下,如何使修改在重新启动后仍然有效?在不知道确切变量的情况下很难回答,但您可能需要将其添加到您的
my.cnf
文件中。变量是group\u concat\u max\u len
请参见其他答案:。可以使用lineinfile模块进行此操作。如果希望避免重新启动,同时仍确保下次重新启动时的值与您希望的值相同,则可以同时设置此值和var。