Ansible-使用playbook自动化部署mariadb

1,编写mariadb.yaml文件

[ 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

2,检查mariadb.yaml文件语法是否正确

# 检查语法是否正确
ansible-playbook --syntax-check mariadb.yaml

# 执行mariadb.yaml文件,安装并启动mariadb
ansible-playbook mariadb.yaml

# 查看mariadb是否启动
systemctl status mariadb

Ansible-使用playbook自动化部署mariadb

相关推荐