Spinnaker deployment
[infra/stack/kubernetes.git] / apps / spinnaker / kubespray / playbooks / roles / install / tasks / main.yml
diff --git a/apps/spinnaker/kubespray/playbooks/roles/install/tasks/main.yml b/apps/spinnaker/kubespray/playbooks/roles/install/tasks/main.yml
deleted file mode 100644 (file)
index e90fbad..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
----
-# ============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: Load execution mode variables
-  include_vars: "{{ execution_mode }}.yaml"
-
-- block:
-  - name: Create directories for helm repositories
-    file:
-      path: "{{ item.path }}"
-      state: "{{ item.state }}"
-    loop:
-      - {path: "{{ engine_workspace }}/offline/charts/stable", state: absent}
-      - {path: "{{ engine_workspace }}/offline/charts/stable", state: directory}
-      - {path: "{{ engine_workspace }}/offline/charts/local", state: absent}
-      - {path: "{{ engine_workspace }}/offline/charts/local", state: directory}
-
-  - name: Place index.yaml to webserver stable charts repository
-    template:
-      src: "index.yaml.j2"
-      dest: "{{ engine_workspace }}/offline/charts/stable/index.yaml"
-      force: true
-
-  - name: Create local repo index (empty initially)
-    command: "helm repo index {{ engine_workspace }}/offline/charts/local/"
-    creates: "{{ engine_workspace }}/offline/charts/local/index.yaml"
-  when: execution_mode == "offline-deployment"
-
-- name: Initialize Helm
-  command: helm init --client-only --local-repo-url {{ local_repo_url }} --stable-repo-url {{ stable_repo_url }}
-  register: helm_init_result
-  changed_when: true
-  when: helm_version is version('v3', '<')
-
-- name: Check if stable helm repo exists (helm v3+)
-  command: "helm repo list"
-  changed_when: true
-  failed_when: false
-  register: helm_repo_list_result
-
-- name: Add stable helm repo (helm v3+)
-  command: "helm repo add stable {{ stable_repo_url }}"
-  register: helm_repo_add_stable_result
-  changed_when: true
-  when: >
-    helm_version is version('v3.0.0', '>=')
-    and execution_mode == "online-deployment"
-    and helm_repo_list_result is not search(stable_repo_url)
-
-- name: Add local helm repo (helm v3+)
-  command: "helm repo add local {{ local_repo_url }}"
-  register: helm_repo_add_local_result
-  changed_when: true
-  when: >
-    helm_version is version('v3.0.0', '>=')
-    and execution_mode == "offline-deployment"
-    and helm_repo_list_result is not search(local_repo_url)
-
-- name: Clone Helm Charts repository
-  git:
-    repo: "{{ helm_charts_git_url }}"
-    dest: "{{ engine_cache }}/repos/charts"
-    version: "{{ charts_version }}"
-    force: true
-    recursive: true
-  environment:
-    http_proxy: "{{ lookup('env','http_proxy') }}"
-    https_proxy: "{{ lookup('env','https_proxy') }}"
-    no_proxy: "{{ lookup('env','no_proxy') }}"
-
-- name: Generate values.yaml
-  template:
-    src: "values.yaml.j2"
-    dest: "{{ engine_cache }}/repos/charts/stable/spinnaker/values.yaml"
-    force: true
-
-- name: Remove previous installations of Spinnaker
-  command: >
-    helm delete --purge "{{ spinnaker_service }}"
-  changed_when: true
-  ignore_errors: true
-  tags: reset
-
-- name: Remove Spinnaker namespace
-  command: >
-    kubectl delete ns "{{ spinnaker_namespace }}"
-  changed_when: true
-  ignore_errors: true
-  tags: reset
-
-- name: Create Spinnaker namespace
-  k8s:
-    state: present
-    definition:
-      apiVersion: v1
-      kind: Namespace
-      metadata:
-        name: "{{ spinnaker_namespace }}"
-
-- name: Verify Spinnaker Helm charts are available to be deployed
-  command: helm search spinnaker -l
-  register: helm_search
-  changed_when: false
-
-- name: Log Helm chart list to console
-  debug:
-    msg: "{{ helm_search.stdout_lines }}"
-
-- name: Inform user about Spinnaker deployment
-  debug:
-    msg: >
-      Spinnaker deployment is about to start!
-      This takes a while and nothing will be logged to console until the process is completed.
-
-- name: Fetch all helm dependencies for Spinnaker
-  command: >
-    helm dependency update
-      {{ engine_cache }}/repos/charts/stable/spinnaker
-  changed_when: true
-
-- name: Install Spinnaker using helm
-  command: >
-    helm install
-      {% if helm_version is version('v3.0.0', '<')%} --name {% endif %}"{{ spinnaker_service }}"
-      --namespace "{{ spinnaker_namespace }}"
-      --timeout "900{% if helm_version is version('v3.0.0', '>=') %}s{% endif %}"
-      {{ engine_cache }}/repos/charts/stable/spinnaker
-  register: spinnaker_helm_log
-  changed_when: true
-
-- name: Log Spinnaker helm output to console
-  debug:
-    msg: "{{ spinnaker_helm_log.stdout_lines }}"
-
-# wait 10 minutes for all containers to be started
-- name: Wait for all containers to be started
-  shell: |
-    set -o pipefail
-    kubectl get po -n spinnaker | grep ContainerCreating | wc -l
-  register: kube
-  changed_when:
-    kube.stdout  == '0'
-  until:
-    kube.stdout  == '0'
-  retries: 60
-  delay: 10
-
-# wait 20 minutes for all containers to be initialized
-- block:
-    - name: Wait for all containers to be initialized
-      shell: |
-        set -o pipefail
-        kubectl get po -n spinnaker | grep Init | grep -v Error | wc -l
-      register: kube
-      changed_when:
-        kube.stdout  == '0'
-      until:
-        kube.stdout  == '0'
-      retries: 120
-      delay: 10
-  always:
-    - name: Get POD status
-      command: kubectl get po -n spinnaker
-      changed_when: false
-      register: kube
-
-    - name: Log POD status to console
-      debug:
-        msg: "{{ kube.stdout_lines }}"
-
-    - name: Get summary of Spinnaker deployment
-      script: log-spinnaker-status.sh
-      register: spinnaker_status
-
-    - name: Log Spinnaker status to console
-      debug:
-        msg: "{{ spinnaker_status.stdout_lines }}"
-
-# vim: set ts=2 sw=2 expandtab: