Configure python and server fqdn as part of provisioner
The installation stage should assume that the provisioned nodes have
all the basic installation and configuration completed. Examples are
- python is available on nodes so Ansible can be used
- server fqdn is added to /etc/hosts
- if running in offline mode, sources.list is updated with server fqdn
Change-Id: If74cc945d88f3512511a6c6d845c2bbbefc5737b
diff --git a/playbooks/roles/configure-targethosts/files/install-python.sh b/playbooks/roles/configure-targethosts/files/install-python.sh
new file mode 100755
index 0000000..f0b5337
--- /dev/null
+++ b/playbooks/roles/configure-targethosts/files/install-python.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+# ============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 -o errexit
+set -o pipefail
+
+# NOTE: due to stack creation issues on public cloud, installation of python
+# and python-dev has been moved out of heat templates. The reason for this is
+# that during initial boot of the instances, Ansible prerequisites python and
+# python-dev are installed using boot script. Due to the reasons we can not
+# explain and perhaps because of network issues on public cloud, apt fails,
+# complaining about corruption - checksum mismatch. In turn, problematic
+# instance(s) can not send completion signal at the end of boot phase, resulting
+# in timeouts in stack creation thus complete failure of deployments.
+
+source /etc/os-release || source /usr/lib/os-release
+case ${ID,,} in
+ ubuntu|debian)
+ export DEBIAN_FRONTEND=noninteractive
+ sudo -H -E apt update -q=3
+ sudo -H -E apt install -y -q=3 python python-dev
+ ;;
+ rhel|fedora|centos)
+ sudo yum install -y python python-devel
+ ;;
+ *)
+ echo "ERROR: Supported package manager not found. Supported: apt, dnf, yum, zypper"
+ exit 1
+ ;;
+esac
+
+# vim: set ts=2 sw=2 expandtab: