adjust the execution pipeline for vnf 99/53499/7
authorzhihui wu <wu.zhihui1@zte.com.cn>
Mon, 12 Mar 2018 09:08:16 +0000 (17:08 +0800)
committerzhihui wu <wu.zhihui1@zte.com.cn>
Wed, 14 Mar 2018 07:22:10 +0000 (15:22 +0800)
- 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>
resources/ansible_roles/openstack/tasks/main.yml
resources/ansible_roles/qtip-generator/files/compute/run.yml
resources/ansible_roles/qtip-generator/files/compute/setup.yml

index b42c43f..5794226 100644 (file)
       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)
index f8e71f0..59f84c3 100644 (file)
 
 - 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] }
index 037f574..c3e8f58 100644 (file)
   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 %}