playbook核心元素之 --> tasks 介绍
简单示例
[root@ansible ~]# vim test1.yaml - hosts: centos6 remote_user: root tasks: - name: add a group group: name=ansgroup1 system=false - name: add a user user: name=ansuser1 group=ansgroup1 system=false - name: restart httpd service service: name=httpd state=restarted
[root@ansible ~]# ansible-playbook --syntax-check test1.yaml --> 语法测试[root@ansible ~]# ansible-playbook -C test1.yaml --> 测试执行
[root@ansible ~]# ansible-playbook test1.yaml --> 执行