- Add a new execution logic for vnf. use a variable "sut"
as the conditional judgement.
- Loop attempt to connect the vnf
- check whether install python in remote target
Change-Id: I29b13603a0f75380471c586c642d46d626d8ce22
Signed-off-by: zhihui wu <wu.zhihui1@zte.com.cn>
       external_network: "{{ external_network }}"
   register: stack
 
+- name: Wait 600s for vm connection to become reachable/usable
+  wait_for:
+    host: "{{ item.output_value }}"
+    port: 22
+    timeout: 600
+    search_regex: OpenSSH
+  with_items: "{{ stack.stack.outputs }}"
+
 - name: generating inventory file
   template:
     src: hosts.j2
   template:
     src: ssh.cfg.j2
     dest: ./ssh.cfg
-
-- name: Wait 600 seconds for target connection to become reachable/usable
-  wait_for_connection:
-
-- name: install python 2
-  raw: test -e /usr/bin/python || (apt-get -y update && apt-get install -y python-minimal)
 
 
 - hosts: SUT
 
+{% if sut == 'vnf' %}
+  gather_facts: no
+  pre_tasks:
+    - name: check whether install python 2 in target
+      become: yes
+      raw: test -e /usr/bin/python || (apt-get -y update && apt-get install -y python-minimal)
+    - name: gather facts
+      setup:
+{% endif %}
+
   roles:
   # prepare environment
   - { role: qtip, tasks: setup-node, tags: [setup] }
 
   gather_facts: no
   roles:
     - { role: openstack, external_network: {{ network_group[installer_type] }}, heat_template: heat_template.yml }
-{% endif %}
+
+{% elif sut == 'node' %}
 
 {% if installer_type == 'manual' %}
 - hosts: localhost
   gather_facts: no
   tasks:
-    - debug: "msg='please add hosts to SUT group in `hosts` file manually.'"
+      - debug: "msg='please add hosts to SUT group in `hosts` file manually.'"
+
 {% else %}
 - hosts: [{{ installer_group[installer_type] }}]
   roles:
-    - { role: qtip, tasks: generate-inventory }
+      - { role: qtip, tasks: generate-inventory }
+{% endif %}
 {% endif %}