Member-only story

Not a valid attribute for a Play error — Ansible troubleshooting

How to reproduce, troubleshoot, and fix the “not a valid attribute for a Play” error.

Luca Berton
3 min readSep 21, 2021

Today we’re going to talk about Ansible troubleshooting and specifically about the “not a valid attribute for a Play” error.
I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

demo

The best way of talking about Ansible troubleshooting is to jump in a live demo to show you practically the `not a valid attribute for a Play` error and how to solve it!

  • invalid_play_attribute_error.yml
---
- name: file module demo
hosts: all
vars:
myfile: "~/example.txt"
task:
- name: Creating an empty
ansible.builtin.file:
path: "{{ myfile }}"
state: touch
  • output
$ ansible-playbook -i demo/inventory troubleshooting/invalid_play_attribute_fix.yml
ERROR! ‘task’ is not a valid attribute for a Play
The error appears to be in 'ansible-pilot/troubleshooting/invalid_play_attribute_error.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line…

--

--

Luca Berton
Luca Berton

Written by Luca Berton

I help creative Automation DevOps, Cloud Engineer, System Administrator, and IT Professional to succeed with Ansible Technology to automate more things everyday

No responses yet