自动化卸载二进制安装mysql以及文件
[root@ansible ~]#cat remove_mysql.yml
---
# remove mysql server
- hosts: appsrvs:!192.168.39.61
remote_user: root
tasks:
- name: stop service
shell: /etc/init.d/mysqld stop
- name: delete user
user: name=mysql state=absent remove=yes
- name: delete
file: path={{item}} state=absent
with_items:
- /usr/local/mysql
- /usr/local/mariadb-10.2.27-linux-x86_64
- /etc/init.d/mysqld
- /etc/profile.d/mysql.sh
- /etc/my.cnf
- /data/mysql
#运行
[root@ansible ~]#ansible-playbook remove_mysql.yml