# How can selectively run build commands per site?

**URL:** https://discourse.roots.io/t/how-can-selectively-run-build-commands-per-site/4557
**Category:** trellis
**Created:** 2015-08-24T14:18:51Z
**Posts:** 6
**Showing post:** 4 of 6

## Post 4 by @patrickv — 2015-08-25T17:24:37Z

Thanks for the detailed solution. I tested both of them in order to understand a bit more how to work with trellis and ansible. Both worked.

Adding the `pre_build_commands_local` to the `wordpress_sites` worked fine except that I had to change `{{ project.local_path }}` to an explicit directory. Would it be possible to reference a variables from the current array in that case? `local_path` is declared just before `pre_build_commands_local`. Anyhow I got it working, I am taking the opportunity to learn. :smile:

As for adding `when: project.run_pre_build_commands_local`, would it be possible to change the deploy task you specify without changing the file in the `roles` directory? Can I redefine a task or add the conditional from… my `group_vars/development` file?

---

_[View the full topic](https://discourse.roots.io/t/how-can-selectively-run-build-commands-per-site/4557)._
