when condition not being evaluated with include statement

I have a tikitaka3.yml (main yml file) and a tikitaka3a.yml (playbook to be included) . When I prompt the user for a variable and then in the tasks section when I call it, like so:

The when does not affect the include itself, it gets added to all tasks included.​

Take a look at the docs of the “group_by” module if you want some more elegant output based on dynamic criteria.

Then what can I do to achieve the functionality that I require?

Basically I want to run my secondary playbook on a specific number of hosts in a specific group (I have shown just one example of a group here i.e. umar, I intend on having three groups) using var_prompts, the group is going to be specified in my main file whereas the logic for particular host selection will reside in each of the 3 secondary playbooks for example the user wants to modify the first 3 nodes (from a total of 15) in the group named umar

The group_by module?

Well, I think I will just make a predefined number of groups such as EPC1, EPC2 and EPC4 (each containing 1,2 or 4 EPCs) , similarly do the same for CLIENTS and SERVERS and tell the user to modify the hosts at the start of a play book such as

  • hosts: SERVER1:EPC2:CLIENTS4

This is very inefficient, but I don’t know what to do. Can the group-by module do something similar without having to do something that is so inefficient