大佬教程收集整理的这篇文章主要介绍了如何为此 cmd 编写 Ansible Playbook => mysql_secure_installation,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
如果我在 linux 终端中运行这个 cmd @H_48_3@mysqL_secure_installation,它将要求用户输入(y/n/other 选项)。 如何在 ansible playbook 中反映相同的内容?我尝试为此 cmd @H_48_3@mysqL_secure_installation 使用 sHell 模块,但不确定如何编写如下所示的用户输入。
[我的任务是使用 Ansible Playbook 安装 @H_48_3@mysqLDB。此外,我还附上了 @H_281_11@mysqL 安装的手动步骤。请帮我写一个同样的剧本。]
提前致谢。
#############################################################
Press y|Y for Yes,any other key for No: y
Please enter 0 = LOW,1 = MEDIUM and 2 = STRONG: 1
Please set the password for root here.
New password: <my-password>
Re-enter new password: <my-password>
Do you wish to conTinue with the password provIDed?(Press y|Y for Yes,any other key for No) : y
Remove anonymous users? (Press y|Y for Yes,any other key for No) : y
disallow root login remotely? (Press y|Y for Yes,any other key for No) : n
Remove test database and access to it? (Press y|Y for Yes,any other key for No) : n
Reload privilege tables Now? (Press y|Y for Yes,any other key for No) : y
#############################################################
MysqL Installation:--
sudo wget https://dev.Mysql.com/get/MysqL57-community-release-el7-11.noarch.rpm
sudo rpm -ivh MysqL57-community-release-el7-11.noarch.rpm
sudo yum install -y MysqL-server
sudo systemctl status MysqLd
sudo systemctl start MysqLd
MysqL_secure_installation
.....
MysqL -u root -p
Enter password: <my-password>
GRANT ALL ON root.* TO root@localhost WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
sudo systemctl restart MysqLd
sudo systemctl status MysqLd
-------------------------------------------------------------------------------------------------------------
是的,你有 ansible-galaxy 来检查角色是否存在,但你也有已经存在的模块:
安装Oracle mysql的示例
- name: Install Oracle MySQL repo for RedHat Family.
yum:
name: "{{ redhat_mysql_repo }}"
state: present
when: ansible_os_family == "RedHat" and 'mysql' in group_names
另一个示例:
- name: Initialize MySQL 8.0 Insecure.
sHell: >
mysqld --initialize-insecure
when: ('8.0.' in mysql_cli_version.stdout) and (ansible_os_family == "RedHat")
您可以在 Install MySql_8
看到示例以上是大佬教程为你收集整理的如何为此 cmd 编写 Ansible Playbook => mysql_secure_installation全部内容,希望文章能够帮你解决如何为此 cmd 编写 Ansible Playbook => mysql_secure_installation所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。