Skip to content

Instantly share code, notes, and snippets.

@dekimsey
Last active January 17, 2017 18:13
Show Gist options
  • Save dekimsey/015e3131625e00878b8bf6cee3aa6f02 to your computer and use it in GitHub Desktop.
Save dekimsey/015e3131625e00878b8bf6cee3aa6f02 to your computer and use it in GitHub Desktop.
cannot filter host_lists with group_by generated groups
# ansible-playbook -i localhost, filtering-by-group_by.yml
- name: Gather facts and partition hosts
hosts: '!__partitioned'
become: false
connection: local
tasks:
- group_by:
key: __skipme
- group_by:
key: __partitioned
- hosts: all
become: false
connection: local
tasks:
- debug: var=group_names
- hosts: '!all'
become: false
connection: local
tasks:
- fail: msg='I should not run, !all filter used'
- hosts: '!__skipme'
become: false
connection: local
tasks:
- fail: msg='I should not run, !__skipme filter used'
- hosts: '!__partitioned'
become: false
connection: local
tasks:
- fail: msg='I should not run, !__partitioned filter used'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment