Initial implementation of offline engine deployment

A new option has been added "-x" to execute this use case.
It will use a predefined tar.gz package that contains all
the necessary files to perform the installation of
k8s-calico-nofeature scenario and has to be downloaded in
advance. It has been documented the structure of this file
and how to fetch the dependencies in an online machine.

Apt dependecies are handled by apt-cacher-ng that sets up
a proxy in localhost. This is used by the newly created nodes.
Kubespray cache (binaries and docker images) is copied to the
nodes and the playbook is configured to use those files.

In post deployment, the remaining of Docker images are pre-
loaded in the target machines. A better solution would be
to establish a local docker repository, but it is left out
of this patchset.

Change-Id: I3155e3bca56435a97f165a266935e7fec49f1a4d
diff --git a/playbooks/roles/install-configure-bifrost/tasks/configure-bifrost-offline.yml b/playbooks/roles/install-configure-bifrost/tasks/configure-bifrost-offline.yml
new file mode 100644
index 0000000..10990e9
--- /dev/null
+++ b/playbooks/roles/install-configure-bifrost/tasks/configure-bifrost-offline.yml
@@ -0,0 +1,55 @@
+---
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 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=========================================================
+
+# Set-up Bifrost dependencies for offline installation
+- name: Unpack local repositories in engine cache
+  synchronize:
+    src: "{{ engine_cache }}/offline/repos/"
+    dest: "{{ engine_cache }}/repos"
+
+- name: Create folder to override Bifrost dependencies
+  file:
+    path: "{{ engine_cache }}/repos/bifrost/playbooks/roles/bifrost-prep-for-install/vars"
+    state: directory
+
+- name: Configure local copy of Bifrost dependencies
+  template:
+    src: "offline-repos.j2"
+    dest: "{{ engine_cache }}/repos/bifrost/playbooks/roles/bifrost-prep-for-install/vars/main.yml"
+
+- name: Enable use of local repositories in Bifrost
+  lineinfile:
+    path: "{{ engine_cache }}/repos/bifrost/playbooks/roles/bifrost-prep-for-install/defaults/main.yml"
+    regexp: "^copy_from_local_path:.*"
+    line: "copy_from_local_path: true"
+
+# This is necessary due to an "&" condition in Bifrost code which should be "|"
+- name: Enable use of local repositories in Bifrost
+  lineinfile:
+    path: "{{ engine_cache }}/repos/bifrost/playbooks/roles/bifrost-prep-for-install/defaults/main.yml"
+    regexp: "^ci_testing_zuul:.*"
+    line: "ci_testing_zuul: true"
+
+- name: Copy offline images
+  synchronize:
+    src: "{{ engine_cache }}/offline/images/"
+    dest: "/httpboot"
+  become: true
+
+# vim: set ts=2 sw=2 expandtab: