时间:2021-07-01 10:21:17 帮助过:17人阅读
[root@manager-161 playbook]# cat mysql.yaml
- hosts: mysql
tasks:
- name: install mariadb
yum: name=mariadb-devel,mariadb-server state=installed
- name: install python-devel pip
yum: name=python-devel,python2-pip state=installed
- name: shell mtsql-python
shell: ‘pip install MySQL-python‘
- name: statr mariadb
service: name=mariadb state=started enabled=yes
- mysql_user:
user: root
password: sf123
update_password: always
- name: create wordpress
mysql_db:
name: ‘root‘
login_host: ‘localhost‘
login_password: ‘zsf123‘
name: ‘wordpress‘
state: ‘present‘
- mysql_user:
user: ‘root‘
login_host: ‘localhost‘
login_password: ‘zsf123‘
user: ‘zzsf‘
password: ‘zsf124‘
priv: ‘*.*:ALL‘
state: present
- mysql_user:
user: ‘root‘
login_host: ‘localhost‘
login_password: ‘zsf123‘
user: ‘zzsf‘
password: ‘zsf124‘
priv: ‘*.*:ALL‘
host_all: yes
state: present
- mysql_db:
user: ‘root‘
login_host: 127.0.0.1
login_password: zsf123
name: lt
state: present
#mariadb安装之后没有密码,我们必须先更改root的密码
然后mysql需要安装mysql-python的模块
yum -y install python-devel,python2-pip
pip install mysql
ansible通过剧本管理mysql
标签:use cal book login password man star 解决 adb