Skip to content

Instantly share code, notes, and snippets.

@mikerowehl
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikerowehl/b4d0a1408f1e0d449e9f to your computer and use it in GitHub Desktop.
Save mikerowehl/b4d0a1408f1e0d449e9f to your computer and use it in GitHub Desktop.
Negative pattern in ansible
- hosts: tag_clusterType_*
connection: local
gather_facts: false
tasks:
- name: Get everything in a cluster
debug: var=hostvars[inventory_hostname]['ec2_tag_Name']
- hosts: all:!tag_clusterType_*
connection: local
gather_facts: false
tasks:
- name: Everything else
debug: var=hostvars[inventory_hostname]['ec2_tag_Name']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment