mysql的体系结构
MySQL的安装(ansible)
清单文件(inventory)
[local]
192.168.10.128
[test1]
192.168.10.129
[test2]
192.168.10.130
[test:children]
test1
test2
[all:vars]
ansible_user=root
ansible_password=redhat
配置文件(ansible.cfg)
[defaults]
inventory=/etc/testansible/inventory
remote_user=root
ask_pass=false
playbook代码(dnf_mysql.yml)
---
- name: install and start mysql
hosts: test2
tasks:
- name: download mysql packages
get_url:
url: https://repo.mysql.com//mysql80-community-release-el8-4.noarch.rpm
dest: /root/class_packages
- name: install mysql rpm
yum:
name: /root/class_packages/mysql80-community-release-el8-4.noarch.rpm
state: present
- name: install service mysql
yum:
name: mysql-server
state: present
- name: restart service mysql
service:
name: mysqld
state: restarted
MySQL的卸载——del_mysql.yml
---
- name: stop and remove service mysql
hosts: test2
tasks:
- name: stop service mysql
service:
name: mysqld
state: stopped
- name: remove service mysql
yum:
name: mysql*
state: absent