错误!“文件"不是播放的有效属性 [英] ERROR! 'file' is not a valid attribute for a Play

查看:23
本文介绍了错误!“文件"不是播放的有效属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新的剧本测试不起作用.ansible 的新手,但已经通读了文档、示例等.怎么了 ?<代码>错误!文件"不是播放的有效属性

new playbook test is not working. Newbie to ansible but have read throuugh the docs , samples etc. What is wrong ? ERROR! 'file' is not a valid attribute for a Play

错误似乎在 '/home/NTNET/mresnick/testdel.yml':第 10 行,第 3 列,但可能位于文件中的其他位置,具体取决于确切的语法问题.

The error appears to have been in '/home/NTNET/mresnick/testdel.yml': line 10, column 3, but may be elsewhere in the file depending on the exact syntax problem.

违规行似乎是:

- 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 }
...

推荐答案

您编写了一个任务列表并尝试将其作为剧本运行.

You wrote a tasklist and tried to run it as a playbook.

当你有剧本时,你可以在给定的剧本中有一个 tasks 键,并在那里列出你喜欢的任务.

When you have a playbook, you can have a tasks key in a given play, and list your preferred task there.

---

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

...

这篇关于错误!“文件"不是播放的有效属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆