Ansible: i need to start a server from one node if the server in another node starts.

ISSUE TYPE

Need help in writing the ansible logic.

ANSIBLE VERSION

ansible 2.2.1.0
Hi All, I need Help for starting and Stopping the servers in WebSphere,
I have a 9 nodes in websphere, Node1 have 3 servers(Message, CW, CP), Node2 Have 3 servers((Message, CW, CP), Node3 have 2(CW, CP) servers, Node4 2 servers(CW, CP), Node5 have 3 servers(ASS, CW, WEB), Node6 have 3 servers(ASS, CW, WEB), Node7 have 3 serers(ASS, CW, WEB), Node 8 have 3 servers(ASS, CW, WEB), Node 9 have 1 servers(CW),

With My ansibel script, First I am staring Deployment Manager, then i sync the Nodes to deplyment manger if Dmanger running, if node sync successful then i am starting nodeagents,
if Nodeagents started successfully then i am starting server1(Message) on Node1 and 2,

Here i need to start the servers(ASS) on Node5, Node6, Node7 and Node8 if server(Message) started successfully on Node1 and Node2,

Here i need to start the Servers(WEB) on Node5, Node6, Node7 and Node8 if server(Message) started successfully on Node1 and Node2, and Server(ASS) started successfully on Node5, Node6, Node7 and Node8…

Can some one please help to write the code in Ansible, The script i have written are attached here,
i am also attaching my hostfile.

[ATST-CURAMDMGR]

xx.xxx.xx.1

[ATST-CURAMAPPSRV]

xx.xxx.xx.1

xx.xxx.xx.2

xx.xxx.xx.3

xx.xxx.xx.4

xx.xxx.xx.5

xx.xxx.xx.6

xx.xxx.xx.7

xx.xxx.xx.8

xx.xxx.xx.9

Yamal(Ansibel) script