是否可以使用mysql_user ansible模块删除mysql root用户以进行远程登录?

问题描述 投票:0回答:1

在MySQL中是否可以使用Ansible模块mysql_user远程禁止root登录?

类似这样,但对于所有主机,不仅限于ansible_fqdn:

- name: Delete root MySQL user for remote logins
  mysql_user: 
   user: root
   host: "{{ansible_fqdn}}"
   state: absent
   login_password: abc
   login_user: root
mysql linux ansible
1个回答
0
投票

我们可以在此使用host_all选项。

- name: Ensure no user named 'sally' exists at all
  mysql_user:
    name: sally
    host_all: yes
    state: absent

仅用于参考,请遵循doc:-https://docs.ansible.com/ansible/latest/modules/mysql_user_module.html

© www.soinside.com 2019 - 2024. All rights reserved.