Multiple hosts in playbook

HI all,

I have a playbook with 2 inventory groups. primary and secondary, where I want to run few tasks primary and few with secondary in a single playbook. How can I get that. need your help.

Playbooks contain plays, each play can target a different set of hosts, so just:

- hosts: primary
  tasks:
    .....

- hosts: secondary
  tasks:
    ....

okay I got it . that’s fine . but when I run this play in ansible tower, how can I get the primary and secondary host name from survey option to prompt form user to enter the hostnames.

Sorry for the late question. How can I make a condition that play 2 should run when play 1 is succeed