I think setting a variable is one straight forward way to go about solving
the problem, conditionally running tasks if the variable is set. See this:
http://docs.ansible.com/playbooks_conditionals.html#applying-when-to-roles-and-includes

Another way is to create a group of devel servers in inventory or
dynamically, and create a play that only runs on the devel group.

On Monday, March 24, 2014, Shaunak Kashyap <ycombina...@gmail.com> wrote:

> Hi,
>
> I would like to conditionally execute some tasks within a play (or even
> the entire play itself) only if I'm setting up a development environment. What
> is the best way to perform such conditional execution?
>
> One way I can think of is to define a variable (say "deploy_env=true") in
> my dev inventory file (hosts.dev), then use the "when" statement within the
> conditional tasks to look for that variable (i.e. when: deploy_env ==
> true). Is this a good approach or is there a better way to define and
> run environment-specific tasks/plays?
>
> Thanks,
>
> Shaunak
>
>  --
> 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-project+unsubscr...@googlegroups.com<javascript:_e(%7B%7D,'cvml','ansible-project%2bunsubscr...@googlegroups.com');>
> .
> To post to this group, send email to 
> ansible-project@googlegroups.com<javascript:_e(%7B%7D,'cvml','ansible-project@googlegroups.com');>
> .
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/5a82dc55-9dbf-4c5b-a420-77c5c7a3af43%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/5a82dc55-9dbf-4c5b-a420-77c5c7a3af43%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAK6JQEE6NLe0nfOWHmdCYZr2S%2B1gqMw%2Baur5N3dkFo_qS7GkzQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to