2016-07-28 114 views
4

新的Playbook测试不起作用。新手给予理解,但已阅读文档,样本等。 有什么不对? ERROR! 'file' is not a valid attribute for a Play错误! '文件'不是Play的有效属性

的误差似乎一直在'/home/NTNET/mresnick/testdel.yml':线10,第3列,但也可以 取决于确切的语法问题在文件中在别处。

出错行似乎是:

- file: "path=/tmp/{{ item }} state=absent recurse=no" 
^here 


--- 
- name: test playbooktestdel 
- hosts: temp3 
    tasks: 
- name: "delete old files Aveksa" 
- file: path=/tmp/{{ item }} state=absent recurse=no 
    with_items: 
    - { Aveksa.tar } 
    - { sudo_commands } 
    - { baz } 
... 
+0

修正阳明的副本:--- - 名称:测试playbooktestdel - 主机:TEMP3 任务: - 名称: “删除旧文件Aveksa” - 文件:路径=/tmp目录/ {{项目}} state = absent recurse = no with_items: - {Aveksa.tar} - {sudo_commands} - {baz} ... –

回答

3

你写了一个任务列表,并试图运行它作为一个剧本。

当你有一本游戏手册时,你可以在给定的游戏中有一个tasks键,并在那里列出你的首选任务。

--- 

- hosts: your hosts 
    tasks: 
    - name: delete sg 
     file: 
     path: "/tmp/{{ item }}" 
     state: absent 
     recurse: no 

... 
相关问题