On the first part, can you show your new playbook and the output?

As to your question, yes.


- hosts: all
  tasks:
     - group_by: key=test-{{ a > b }}

- hosts: test-True
  tasks: # or roles, here, etc
     - ping

- hosts: tests-False
  tasks:
     - ping

The group_by module basically carves up hosts based on arbitrary criteria,
creating dynamic groups that are very useful for this sort of thing.

http://docs.ansible.com/group_by_module.html




On Tue, Aug 19, 2014 at 3:54 AM, Imran Khan <[email protected]>
wrote:

> Thanks for the quick reply. I fixed those issue, but the main problem
> remains. The if condition is not evaluated.
> P.S: I am going off topic here, but is there any way for me to place a
> when condition on a complete playbook or say for the first 10 tasks in a
> playbook etc?
>
>
> On Monday, August 18, 2014 5:32:20 AM UTC-7, Michael DeHaan wrote:
>
>> Looks like you are missing a tasks section and also have some indent
>> issues.
>>
>>
>>
>>
>> On Mon, Aug 18, 2014 at 6:55 AM, Imran Khan <[email protected]> wrote:
>>
>>> 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
>>>
>>> ---
>>> - hosts: all
>>>
>>>  vars:
>>>    khan:
>>>
>>>   vars_prompt:
>>> - name: targetenv
>>>   prompt: "Select group to modify 1.)EPC 2.)CLIENTS 3)TESTERS"
>>>   private: False
>>>   default: "1"
>>>
>>>
>>> - name: Inlude playbook tikitaka3a
>>>   include: /home/khan/Desktop/playbooks/tikitaka3a.yml target=targetenv
>>>   when: targetenv.stdout|int < 2 #this condition does not work, explained 
>>> below
>>>   #when: targetenv == 1 or "1" #this doesn't work either
>>>
>>> - name: Debugging
>>>   debug: var=targetenv.stdout
>>>
>>> I get this error when I run the playbook *"ERROR: vars_prompt is not a
>>> legal parameter in an Ansible task or handler"*
>>>
>>> --
>>> 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 [email protected].
>>> To post to this group, send email to [email protected].
>>>
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/ansible-project/61a62923-7904-4a0e-9886-
>>> 7239d53d67bb%40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/61a62923-7904-4a0e-9886-7239d53d67bb%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/9426e1ba-cf22-4bac-8958-50d899fa8018%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/9426e1ba-cf22-4bac-8958-50d899fa8018%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgwwVD0ziFz6P7ASFRkqmpkUFtsEZQLrjmko22jX5LPiLQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to