Add support for packaging and offline execution

This change request adds support for packaging onap test framework based on xtesting and its offline execution.

Signed-off-by: eprasad <prasad.mukhedkar@est.tech>
Change-Id: Id7f2ff688e46d059c60f2bd74e5dec118096202d
Signed-off-by: eprasad <prasad.mukhedkar@est.tech>
diff --git a/playbooks/roles/package/tasks/main.yaml b/playbooks/roles/package/tasks/main.yaml
new file mode 100644
index 0000000..9df4c7b
--- /dev/null
+++ b/playbooks/roles/package/tasks/main.yaml
@@ -0,0 +1,92 @@
+---
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2020 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+#- name: Prepare packaging
+#  include_tasks: prepare-packaging.yaml
+
+- name: Create folder to store dependencies for offline testing
+  file:
+    path: "{{ offline_pkg_folder }}"
+    state: "{{ item }}"
+  with_items:
+    - absent
+    - directory
+
+- name: Install packages on {{ ansible_os_family }}
+  include_tasks: "install-packages-{{ ansible_os_family }}.yml"
+
+
+# collect apt packages
+- name: Fetch operating system packages
+  include_tasks: "pkg-{{ ansible_os_family }}.yaml"
+
+# clone git repositories
+- name: Fetch git repositories
+  include_tasks: git.yaml
+
+# download pip packages
+- name: Fetch pip python packages
+  include_tasks: pip.yaml
+
+# fetch xtexting container images
+- name: Fetch container images
+  include_tasks: containers.yaml
+
+# ensure we don't have leftovers
+- name: Delete outdated files
+  file:
+    path: "{{ item }}"
+    state: absent
+  with_items:
+    - "{{ offline_pkg_file }}"
+    - "{{ offline_pkg_folder }}/test.sh"
+    - "{{ offline_testing_file }}"
+    - "/tmp/decompress.sh"
+
+- name: Copy decompress and run scripts
+  copy:
+    src: "{{ item.src }}"
+    dest: "{{ item.dest }}"
+    mode: 0755
+  with_items:
+    - {src: "test.sh", dest: "{{ offline_pkg_folder }}/test.sh"}
+    - {src: "decompress.sh", dest: "/tmp/decompress.sh"}
+
+# check if the packaging is run by release job by looking at /tmp/release.properties
+- name: Check if /tmp/release.properties file exists
+  stat:
+    path: /tmp/release.properties
+  register: release_properties
+
+# record repo shas in release.properties file if it exists and
+# copy release.properties to tarball
+- name: Record test repo SHAs in release.properties
+  include_tasks: record-shas.yaml
+  when: release_properties.stat.exists
+
+# create tarball
+- name: Create test installer file
+  script: build.sh
+  register: build_script
+
+- name: Log build script output to console
+  debug:
+    msg: "{{ build_script.stdout_lines }}"
+
+# vim: set ts=2 sw=2 expandtab: