Pre_tasks using best practices layout

1,047 views
Skip to first unread message

fokeyjo

unread,
Jul 10, 2014, 10:42:10 AM7/10/14
to ansible...@googlegroups.com
Hiya,

Hopefully this is an easy quick question.. I'm using the layout described in http://docs.ansible.com/playbooks_best_practices.html.

I want to define a pre-task to a role defined in meta/main.yml, but I can't seem to do it. If my tasks/main.yml looks like this:
---
pre_tasks:
- name: Install virtualenv
  yum: name=python-virtualenv state=present

I get: ERROR: expecting dict; got: pre_tasks, error in <snip>/tasks/main.yml

The page http://docs.ansible.com/playbooks_roles.html#roles seems to indicate that no other files or folders represent pre_tasks.

So how do I define pre_tasks?

Thanks,

Fokeyjo

Michael DeHaan

unread,
Jul 11, 2014, 6:26:35 PM7/11/14
to ansible...@googlegroups.com
Ansible roles don't have a way of defining pre and post tasks. 

They are usually defined as a way to do things before applying generic tasks/roles, like load balancing, and it would be a little confusing to have them in the list of roles when some steps would be executed out of order.




--
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/90da8260-ebca-4749-b327-663bae0b7036%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages