# 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/00-install-packages.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy Required packages
      shell: |
        set -xe;
        ./tools/deployment/developer/01-deploy-k8s.sh
      vars:
        OSH_INFRA_PATH: "{{ zuul_osh_infra_relative_path | default('') }}"
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Setup OS and K8s Clients
      shell: |
        set -xe;
        ./tools/deployment/developer/02-setup-client.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy Ingress
      shell: |
        set -xe;
        ./tools/deployment/developer/03-ingress.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy Ceph
      shell: |
        set -xe;
        ./tools/deployment/developer/04-ceph.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy Ceph NS Activate
      shell: |
        set -xe;
        ./tools/deployment/developer/05-ceph-ns-activate.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy Mariadb
      shell: |
        set -xe;
        ./tools/deployment/developer/06-mariadb.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy RabbitMQ
      shell: |
        set -xe;
        ./tools/deployment/developer/07-rabbitmq.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy Memcached
      shell: |
        set -xe;
        ./tools/deployment/developer/08-memcached.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy Keystone
      shell: |
        set -xe;
        ./tools/deployment/developer/09-keystone.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy Ceph Keystone RadosGW
      shell: |
        set -xe;
        ./tools/deployment/developer/10-ceph-radosgateway.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    # - name: Deploy Horizon
    #   shell: |
    #     set -xe;
    #     ./tools/deployment/developer/11-horizon.sh
    #   args:
    #     chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy Glance
      shell: |
        set -xe;
        ./tools/deployment/developer/12-glance.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy openvswitch
      shell: |
        set -xe;
        ./tools/deployment/developer/13-openvswitch.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy libvirt
      shell: |
        set -xe;
        ./tools/deployment/developer/14-libvirt.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy compute kit
      shell: |
        set -xe;
        ./tools/deployment/developer/15-compute-kit.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy setup gateway
      shell: |
        set -xe;
        ./tools/deployment/developer/16-setup-gateway.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    # - name: Deploy cinder
    #   shell: |
    #     set -xe;
    #     ./tools/deployment/developer/17-cinder.sh
    #   args:
    #     chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy heat
      shell: |
        set -xe;
        ./tools/deployment/developer/18-heat.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"
    - name: Deploy use the cloud
      shell: |
        set -xe;
        ./tools/deployment/developer/19-use-it.sh
      args:
        chdir: "{{ zuul.project.src_dir }}"