Skip to content

Instantly share code, notes, and snippets.

@gmic
Created February 4, 2017 08:48
Show Gist options
  • Save gmic/385d7f4a41eee01435c88c29a03502cd to your computer and use it in GitHub Desktop.
Save gmic/385d7f4a41eee01435c88c29a03502cd to your computer and use it in GitHub Desktop.
Task filter for host group
- name: Example task only run for hosts in the group vagrant
debug: msg="I'm a vagrant box"
when: "vagrant" in group_names
- name: Example task only run for hosts *not* in the group vagrant
debug: msg="I'm not in the vagrant group.. sad panda :("
when: "vagrant" not in group_names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment