第一种写法:
---
- hosts: testB
remote_user: root
tasks:
- name: touch a file
file:
path: /testdir/test1
state: touch
mode: 0644
第二种写法:
---
- hosts: testB
remote_user: root
tasks:
- name: touch a file
file: path=testdir/test1 state=touch mode=0644
第三种写法:
---
- hosts: testB
remote_user: root
tasks:
- name: touch a file
file: path=testdir/test1
state=touch mode=0644
第四种写法:
不建议没有name
---
- hosts: testB
remote_user: root
tasks:
- file: path=testdir/test1
state=touch mode=0644
可以加name 到下面
---
- hosts: testB
remote_user: root
tasks:
- file: path=testdir/test1
state=touch mode=0644
name: make testfiel
---
- hosts: testB
remote_user: root
tasks:
- name: make testfiel
file: path=testdir/test1
state=touch mode=0644