Package module returns error 'package' is not a valid attribute for a Play

3,120 views
Skip to first unread message

Brian Dunbar

unread,
Nov 20, 2015, 3:40:48 PM11/20/15
to Ansible Project
All,

This made me unreasonably excited.

http://docs.ansible.com/ansible/package_module.html

And end to having to define multiple statements for each 'linux distro'.  Neat!

'Installed' Ansible 2 locally ..

$ ansible --version
ansible 2.0.0 (devel 591c81e95f) last updated 2015/11/20 10:08:09 (GMT -500)
  lib/ansible/modules/core: (detached HEAD 88e0bfd75d) last updated 2015/11/20 10:08:13 (GMT -500)
  lib/ansible/modules/extras: (detached HEAD 7da1f8d4ca) last updated 2015/11/20 10:08:16 (GMT -500)
  config file =
  configured module search path = Default w/o overrides

A quickie playbook ..

---
##
# roles/elasticsearch tasks
#

  - name: Install latest version of elasticsearch
    package:
      name: "elasticsearch"
      state: "latest"

And it breaks ..

$ ansible-playbook -i inventory/reliam.hosts roles/elasticsearch/tasks/main.yml
ERROR! 'package' is not a valid attribute for a Play

The error appears to have been in '/Users/bdunbar/git/legacy-tmp/roles/elasticsearch/tasks/configure.yml': line 6, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


  - name: Install latest version of elasticsearch
    ^ here





Matt Martz

unread,
Nov 20, 2015, 4:35:31 PM11/20/15
to ansible...@googlegroups.com
That file you reference is a role task file, not a playbook. As such you cannot run it with ansible-playbook.

You will have to create a proper playbook to execute that role.
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/fc1963cb-ba26-446d-9823-de467d472414%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Matt Martz
@sivel
sivel.net

Brian Dunbar

unread,
Nov 20, 2015, 5:07:59 PM11/20/15
to Ansible Project
D'oh.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages