If there are no hosts added to add host, subsequent plays should be skipped. 
Please let me know how to provide when condition for this

- name:
  hosts:  rchadm01
  vars_files:
  - var.yml
  tasks:
    - name: 
      add_host:
        name: "{{ decom_host }}"
        groups: decom_host_group

- import_playbook: sub_plays/play2.yml
  when: '"decom_host_group" not in group_names'
  

-- 
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/6397ac39-4946-47bf-95f9-c9589c863d1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to