【发布时间】:2021-04-01 09:59:19
【问题描述】:
我在下面尝试了类似 sn-p 的操作,但第二个任务在主机的 shell 终端上执行,而不是在 mysql shell 上执行。如何在第一个任务中对打开的 mysqlsh 执行命令? 例如:我想登录到 shell 并检查 mysql 集群的状态。
tasks:
- name: "connect as clusteradmin"
shell: mysqlsh --uri admin@host1 -p'pass'
- name: "get cluster"
shell: var cluster=dba.getCluster('cluster')
- name: "check status of cluster"
shell: cluster.status()
register: Clustersts
【问题讨论】: