Hi,

I am the OP and i just got an idea for my above question. Do you think 
below script might solve my issue?


   - 
   
   name: PLAYBOOK FOR STANDBY FIREWALL UPGRADE
   
   hosts: STANDBYFIREWALL
   
   serial: 1
   
   gather_facts: false
   
   connection: network_cli
   
   tasks:
   - 
      
      name: End playbook if connection IP is not defined
      
      meta: end_host
      
      when: {{ ansible_host }} is not defined
      
Thanks,
Vikram


On Wednesday, 15 December, 2021 at 9:45:07 pm UTC+5:30 Vikram S wrote:

> I have 2 groups created in hosts file as given below. I have a playbook 
> consisting of 2 plays - the 1st play will be executed on IP in 
> 'ACTIVEFIREWALL' group and 2nd play will be executed on IP in 
> 'STANDBYFIREWALL' group.
>
> Many a times, i have no ip to be give for 'STANDBYFIREWALL' group (so the 
> ip portion remains blank but everything else mentioned below remains on 
> hosts file). So the 2nd play just stops and does nothing until timeout. 
> However when i delete the entire 'STANDBYFIREWALL' group from inventory 
> file, Ansible ignores the 2nd play containing 'STANDBYFIREWALL' group and 
> moves on.
>
>
> Is there any ways i can make Ansible to move on without deleting 
> STANDBYFIREWALL group from hosts file when there is no IP to give?
>
>
> [ACTIVEFIREWALL]
>
> FW1 ansible_host=10.224.240.241
>
>
> [ACTIVEFIREWALL:vars]
>
> ansible_user=username
>
> ansible_ssh_pass=password
>
>
> [STANDBYFIREWALL]
>
> FW2 ansible_host=10.224.240.244
>
>
> [STANDBYFIREWALL:vars]
>
> ansible_user=username
>
> ansible_ssh_pass=password
>
>
> Thanks,
>
> Vikram
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6ec58f94-29b5-4016-bc04-fd659dcf089bn%40googlegroups.com.

Reply via email to