can we have multiple when conditions in a single task?

vars_prompt: 
 - name: input 
   prompt: Please enter the option A,B,C 
   private: no 
 - name: checking the switchshow 
   value_command: 
   command_set:
    - command: ipaddr
    - command: ifconfig
    - command: freespace -m
    - command: yum repolist  

With the above options input A, B, C specific commands associated with that 
option need to be executed. All the commands are there in a single task.

   - A - ipaddr
   - B - ifconfig
   - C - freespace -m , yum repolist

On Thursday, October 22, 2020 at 2:56:09 PM UTC+5:30 [email protected] 
wrote:

> Yes, this can be achievable. You can use when condition.
>
>
> On Thu, Oct 22, 2020 at 11:59 AM Sobhan Anavarapu <[email protected]> 
> wrote:
>
>> I have a question, with optional input of A or B in vars_prompt can the 
>> command be executed in a playbook task.
>>
>>  example
>> - name: checking the switchshow
>>    value_command:
>>    command_set:
>>     - command: switchdisable
>>     - command: switchshow
>>
>> Like with vars_prompt if we select A 1st command need to execute if B 
>> second command need to execute  
>>
>> Can this be achieved with Ansible ?
>>
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/b134e188-0ad0-488e-b8a3-fe66a42350a6n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/b134e188-0ad0-488e-b8a3-fe66a42350a6n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a5c33020-6c4e-42ba-a4b6-7bef0e30e45an%40googlegroups.com.

Reply via email to