新的剧本测试不起作用。 ansible 新手,但已阅读文档、示例等。
怎么了 ?
ERROR! 'file' is not a valid attribute for a 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 }
...
最佳答案
您编写了一个任务列表并尝试将其作为剧本运行。
当您有剧本时,您可以在给定剧本中拥有一个tasks
键,并在其中列出您的首选任务。
---
- hosts: your hosts
tasks:
- name: delete sg
file:
path: "/tmp/{{ item }}"
state: absent
recurse: no
...
关于ansible - 错误! 'file' 不是 Play 的有效属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38632170/