Excluding servers from all

13 views
Skip to first unread message

John Harmon

unread,
Oct 26, 2017, 5:52:11 PM10/26/17
to Ansible Project
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.

Brian Coca

unread,
Oct 26, 2017, 6:18:48 PM10/26/17
to Ansible Project
Just put production in separate non default inventory. All host are always part of all, only way to avoid is host not existing.

J Hawkesworth

unread,
Oct 29, 2017, 4:13:42 PM10/29/17
to Ansible Project
Worth saying when you need to run against everything you can pass multiple inventory files to the ansible-playbook command.
Reply all
Reply to author
Forward
0 new messages