ERROR! 'file' is not a valid attribute for Play

A new play test does not work. To beginners, to understand, but read documents, samples, etc. What's wrong? ERROR! 'file' is not a valid attribute for a Play

It seems that the error was in '/home/NTNET/mresnick/testdel.yml': line 10, column 3, but may be in another place in the file depending on the specific syntax problem.

The violation line is as follows:

- 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 }
...
+4
source share
1 answer

You wrote a task list and tried to run it as a book.

If you have a playbook, you can have a key tasksin this playback and indicate your preferred task there.

---

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

...
+3
source

Source: https://habr.com/ru/post/1649371/


All Articles