# Excluding servers from all

**URL:** <https://forum.ansible.com/t/excluding-servers-from-all/25835>\
**Category:** Ansible Project\
**Created:** [October 26, 2017, 9:52pm UTC](https://forum.ansible.com/t/excluding-servers-from-all/25835 "2017-10-26T21:52:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Harmon](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Harmon](https://forum.ansible.com/u/John_Harmon)\
**Post date:** [October 26, 2017, 9:52pm UTC](https://forum.ansible.com/t/excluding-servers-from-all/25835/1 "2017-10-26T21:52:11Z")

</div>

Just a though I had today. I would like to make sure nobody ever runs ansible against our production servers unless explicitly called by server name or group name. I want the servers/groups to be excluded from “all”. Is this, or something like it valid?

` `all!prodenv`

test1-apps  
prod1-db

[nonprod]  
test[01:20]-apps  
test[01:5]-db

[prodenv]  
prod[01:20]-apps  
`prod[01:5]-db`  
`

I am hoping for a quick way to prevent other uses (not using tower yet) from executing all and having it stop on any production servers on accident.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [October 26, 2017, 10:18pm UTC](https://forum.ansible.com/t/excluding-servers-from-all/25835/2 "2017-10-26T22:18:32Z")

</div>

Just put production in separate non default inventory. All host are always part of all, only way to avoid is host not existing.

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [October 29, 2017, 8:13pm UTC](https://forum.ansible.com/t/excluding-servers-from-all/25835/3 "2017-10-29T20:13:42Z")

</div>

Worth saying when you need to run against everything you can pass multiple inventory files to the ansible-playbook command.
