# Copyright 2017 The Openstack-Helm Authors.
#
# 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.

- hosts: primary
  tasks:
    - name: Deploy Required packages
      shell: |
        set -xe;
        ./tools/deployment/developer/000-install-packages.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
      environment:
        zuul_site_mirror_fqdn: "{{ zuul_site_mirror_fqdn }}"
    - name: Deploy Kubernetes
      shell: |
        set -xe;
        ./tools/deployment/developer/005-deploy-k8s.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
      environment:
        zuul_site_mirror_fqdn: "{{ zuul_site_mirror_fqdn }}"
    - name: Deploy Registry NFS, Redis, and Docker Registry
      shell: |
        set -xe;
        ./tools/deployment/developer/010-deploy-docker-registry.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy NFS for Logging, Monitoring and Alerting Components
      shell: |
        set -xe;
        ./tools/deployment/developer/020-lma-nfs-provisioner.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy LDAP
      shell: |
        set -xe;
        ./tools/deployment/developer/030-ldap.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy Prometheus
      shell: |
        set -xe;
        ./tools/deployment/developer/040-prometheus.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy Alertmanager
      shell: |
        set -xe;
        ./tools/deployment/developer/050-alertmanager.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy Kube-State-Metrics
      shell: |
        set -xe;
        ./tools/deployment/developer/060-kube-state-metrics.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy Node Exporter
      shell: |
        set -xe;
        ./tools/deployment/developer/070-node-exporter.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy Prometheus OpenStack Exporter
      shell: |
        set -xe;
        ./tools/deployment/developer/080-openstack-exporter.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy Grafana
      shell: |
        set -xe;
        ./tools/deployment/developer/090-grafana.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy Nagios
      shell: |
        set -xe;
        ./tools/deployment/developer/100-nagios.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy Elasticsearch
      shell: |
        set -xe;
        ./tools/deployment/developer/110-elasticsearch.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy Fluent-Logging
      shell: |
        set -xe;
        ./tools/deployment/developer/120-fluent-logging.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy Kibana
      shell: |
        set -xe;
        ./tools/deployment/developer/130-kibana.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"