Overall, you are better off customizing your plays for each group (maybe in separate playbooks) instead of trying to make a one-size-fits-all playbook. Tasks can be reused by either importing them or putting them in roles.
The other nice thing about this model is that when you run ansible-playbook --list-roles, you get a nice documented output (assuming you named all of your tasks) of what will happen. However, since we're already here.... 'testserver' is a value, not a variable name. There are a few ways you can do this: 1. Use multiple plays. Have one play run with 'hosts: testservers' and another play run on some other set of hosts. Group the tasks in the appropriate plays. 2. Make your 'when' statement be: when: "'testservers' in group_names" Also, what do you mean by "moved it up one level"? -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/4d6a33fa-77b4-4492-8307-10c53de43a8a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.