| --- |
| # ============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 |
| |
| # enable helm for all the scenarios using kubespray |
| - name: Enable helm |
| lineinfile: |
| path: "{{ engine_cache }}/repos/kubespray/inventory/engine/group_vars/k8s-cluster/addons.yml" |
| regexp: "^helm_enabled:.*" |
| line: "helm_enabled: true" |
| |
| # 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: |