onepiecedn 2020-02-19
[ ansible]# vim mariadb.yaml--- - hosts: mariadb remote_user: root tasks: - name: install mariadb yum: name=mariadb-server state=present - name: start mariadb service: name=mariadb state=restarted enabled=true
# 检查语法是否正确
ansible-playbook --syntax-check mariadb.yaml
# 执行mariadb.yaml文件,安装并启动mariadb
ansible-playbook mariadb.yaml
# 查看mariadb是否启动
systemctl status mariadb