Why does my tasks file (under tasks/do_sth/do_sth.yaml) say "block is a required property"? #3304
-
File looks like this: - hosts: all
become: true
tasks:
- name: Clean logs
ansible.builtin.file:
state: absent
path: "/var/log/myproj.log" and it says:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
I'm not an expert on this, and, perhaps, your case is/was different, but I also hit the similar/same issue today and this was one of very few google hits for me, hence I will make a comment on how I solved it. I experienced warning from
Looking at ansible-lint docs I learned that I had my playbook as I learned that while Ansible itself is pretty relaxed and does not force you to use one specific directory/file layout, without such layout the linter would have hard time figuring out what is what. |
Beta Was this translation helpful? Give feedback.
-
jenkies ... i think it is a "blocking" [x] somewhat confused now please ignore this, but ansible lsp is crash big crash. my stapler. no logs |
Beta Was this translation helpful? Give feedback.
-
I encountered a similar issue : I had a playbook.yaml file in the root dir and a tasks subdir. |
Beta Was this translation helpful? Give feedback.
I'm not an expert on this, and, perhaps, your case is/was different, but I also hit the similar/same issue today and this was one of very few google hits for me, hence I will make a comment on how I solved it.
I experienced warning from
ansible-lint
:Looking at ansible-lint docs I learned that
ansible-lint
considers directory structure to figure out what the purpose of the file is.I had my playbook as
ansible_dir\tasks\stuff.yml
which the linter complained about as it assumed it is just a list of tasks, but for me, it was a playbook.Once I changed directory structure to be
ansible_dir\playbooks\stuff.yml
the linter was happy and so was I.I…