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

1,428 views
Skip to first unread message

Nor Idzuwan Mohammad

unread,
Mar 2, 2016, 8:39:57 AM3/2/16
to Ansible Project
I'm trying to use the expect modules but only getting error

> ansible-playbook -vv --syntax-check passwd.yml

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

The error appears to have been in '/home/users/.local/ansible/playbooks/passwd.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
- hosts: all
  ^ here

my playbook contain:

---
- hosts: all
  remote_user: admin
  become: yes
  gather_facts: no
  tasks:
  - name: "test"
  expect:
    command: passwd username
    responses:
      (?i)password: "MySekretPa$$word"

note: this just a test not my actual password/username

Brian Coca

unread,
Mar 2, 2016, 8:48:10 AM3/2/16
to ansible...@googlegroups.com
expect needs to be correctly indented (line up with the 'n' in name) also you want to make sure the command and rest of parameters are also indented farther than the 'e' in expect.


----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages