Configure Kubespray installer to install Kubernetes
This change configures everything to install Kubernetes using
Kubespray.
As noted in the corresponding files, there are things that could
be pushed into the scenario and it will be done once the basic
installation works from a single place.
Apart from that,. there is a workaround in place to avoid the
Kubespray bug.
https://github.com/kubernetes-sigs/kubespray/issues/4300
Change-Id: I5e3a6831bd371f49b57c41f106e3b854f835f911
diff --git a/playbooks/roles/configure-installer/tasks/main.yml b/playbooks/roles/configure-installer/tasks/main.yml
new file mode 100644
index 0000000..b850457
--- /dev/null
+++ b/playbooks/roles/configure-installer/tasks/main.yml
@@ -0,0 +1,70 @@
+---
+# ============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=========================================================
+
+- name: Remove existing files and directories
+ file:
+ path: "{{ engine_cache }}/repos/kubespray"
+ state: absent
+
+- name: Clone kubespray repository and checkout '{{ kubespray_version }}'
+ git:
+ repo: "{{ kubespray_git_url }}"
+ dest: "{{ engine_cache }}/repos/kubespray"
+ version: "{{ kubespray_version }}"
+ force: yes
+ environment:
+ http_proxy: "{{ lookup('env','http_proxy') }}"
+ https_proxy: "{{ lookup('env','https_proxy') }}"
+ no_proxy: "{{ lookup('env','no_proxy') }}"
+
+# TODO: some stuff below could and perhaps should be pushed into the scenario
+# it is put here to make basic installation work without complexities
+- name: Put initial structure in place
+ synchronize:
+ src: "{{ engine_cache }}/repos/kubespray/inventory/sample/"
+ dest: "{{ engine_cache }}/repos/kubespray/inventory/engine"
+ recursive: yes
+ delete: yes
+
+# TODO: reuse of bifrost dynamic inventory is only valid for the cases that use
+# bifrost for provisioning so this needs fixing and we could perhaps switch to
+# our own inventory, dynamic or static.
+- name: Place bifrost_inventory.py in Kubespray inventory
+ file:
+ src: "{{ engine_cache }}/repos/bifrost/playbooks/inventory/bifrost_inventory.py"
+ dest: "{{ engine_cache }}/repos/kubespray/inventory/engine/bifrost_inventory.py"
+ state: link
+
+- name: Place scenario k8s-cluster.yml
+ copy:
+ src: "k8s-cluster.yml"
+ dest: "{{ engine_cache }}/repos/kubespray/inventory/engine/group_vars/k8s-cluster/k8s-cluster.yml"
+
+# TODO: this task is put here in order to avoid hitting the kubespray bug:
+# https://github.com/kubernetes-sigs/kubespray/issues/4300
+
+- name: WORKAROUND - Place main.yml and docker.yml
+ copy:
+ src: "{{ item.src }}"
+ dest: "{{ item.dest }}"
+ with_items:
+ - { src: "main.yaml", dest: "{{ engine_cache }}/repos/kubespray/roles/kubespray-defaults/defaults/main.yaml" }
+ - { src: "docker.yml", dest: "{{ engine_cache }}/repos/kubespray/inventory/engine/group_vars/all/docker.yml" }
+
+# vim: set ts=2 sw=2 expandtab: