Ansible实用案例之批量重装mysql

ansible all -m command -a "service mysqld stop"
ansible all -m file -a "dest=/home/mysql state=absent"
ansible all -m file -a "dest=/home/mysql_ex state=absent"
ansible all -m file -a "dest=/home/mysql state=directory"
ansible all -m file -a "dest=/home/mysql/data state=directory"
ansible all -m file -a "dest=/home/mysql/log state=directory"
ansible all -m command -a "chown mysql: -R /home/mysql/"
ansible all -m command -a "mysql_install_db --datadir=/home/mysql/data/ --user=mysql"
ansible all -m command -a "service mysqld start"
ansible all -m command -a "cat /root/.mysql_secret"

你可能感兴趣的:(Ansible)