---
- hosts: testservers
  # hosts: test1,test2  # 多个使用英文逗号隔开
  # hosts:  # 或下多个行缩进
  #   test1
  #   test2
  remote_user: root  # 远程的用户名
  tasks:  # 任务列表
  - name: Ping test  # 当省略 name 时，默认以调用的模块的名称作为任务的名称，不建议
    ping:  # ping 测试
  - name: make test directory
    file:  # file 模块，创建目录
      path: /tmp/test
      state: directory

- hosts:  # 过个任务
    testservers
  remote_user: root
  tasks:
  - name: create user t1
    user:
      name: t1

- hosts:
    testservers
  remote_user: root
  tasks:
  - name: touch file
    # 0.8 版本之前，使用 action 关键字调用模块
    # action: file path=/mp/t1 state=touch mode=0644
    file:
      path: /tmp/t1
      state: touch
      mode: 0644
