标签:centos relay 监控 ast iptables play 核心 ems sum
链接:https://pan.baidu.com/s/18vdKcYUHxdOnZjayle_Fkw
提取码:bmvo
复制这段内容后打开百度网盘手机App,操作更方便哦
[root@localhost ~]# vim mysql.yaml
---
- hosts: web
tasks:
- name: 安装mysql服务
yum: name={{ item }} state=installed
with_items:
- mysql
- mysql-server
- name: 分发配置文件 主
copy: src=/root/my.cnf dest=/etc/my.cnf
when: ansible_machine_id == "0db24cc9ab3462952a8ded4f0000000c"
- name: 分发配置文件 从
copy: src=/opt/my.cnf dest=/etc/my.cnf
when: ansible_machine_id == "a3a0f053e7d25013af92585f00000011"
- name: 启动mysql
service: name=mysqld state=started
- name: 授权用户
shell: mysql -e "grant all on *.* to ‘tom‘@‘%‘ identified by ‘123‘"
- name: 刷新权限
shell: mysql -e "flush privileges"
- name: 重置日志
shell: mysql -e "reset master"
- name: 停止slave
shell: mysql -e "stop slave"
- name: 编写日志‘152
shell: mysql -e"change master to master_host=‘192.168.220.169‘,
master_user=‘tom‘,master_password=‘123‘,
master_log_file=‘mysql-bin.000001‘,master_log_pos=106;"
when: ansible_machine_id == "a3a0f053e7d25013af92585f00000011" #判断条件
- name: 编写日志‘169
shell: mysql -e"change master to master_host=‘192.168.220.152‘,
master_user=‘tom‘,master_password=‘123‘,
master_log_file=‘mysql-bin.000001‘,master_log_pos=106;"
when: ansible_machine_id == "0db24cc9ab3462952a8ded4f0000000c" #判断条件
- name: 停止slave
shell: mysql -e "start slave"
- name: 重启msyql
service: name=mysqld state=restarted
- name: 关闭防火墙
service: name=iptables state=stopped
希望看到这篇文章的小伙伴给小编一个赞, (#^.^#)
标签:centos relay 监控 ast iptables play 核心 ems sum
原文地址:https://www.cnblogs.com/yylyu/p/9900735.html