summaryrefslogtreecommitdiffstats
path: root/xci/playbooks
diff options
context:
space:
mode:
authorwutianwei <wutianwei1@huawei.com>2018-01-08 17:17:17 +0800
committerwutianwei <wutianwei1@huawei.com>2018-01-31 17:15:50 +0800
commitb1b71ac7132ff5ccebcfac8ca2bb2f7540025b13 (patch)
tree7306b59b309d9797849a515f754071a0bc526897 /xci/playbooks
parent862219cb61d57598029fc3dfe21923ccd00df257 (diff)
deploy kubernetes in XCI
This commit introduces kubespray into XCI. k8s install currently assumes k8s install and OpenStack install cannot coexist. If XCI_INSTALLER is set to "kubespray" and DEPLOY_SCENARIO is set to "k8-nosdn-nofeature" the xci-deploy.sh would install kubernetes instead of OpenStack. The version of kubernetes is beta release v1.9.0 currently according to the master of kubespray it only support the ubuntu now. Opensuse and centos still need to develop and test. This patch create the directory xci/installer/kubespray, the related files of kubespray would be placed to it. The xci/installer/$installer/playbooks/configure-localhost.yml was moved to xci/playbooks/configure-localhost.yml as a common yaml file. You can modify some parameters according your need in xci/installer/kubespray/files/k8s-cluster.yml to deploy cluster. When deploying kubernetes, it would download the kubespray to releng-xci/.cache/repos/kubespray. If your flavor is Ha, it will download haproxy_server and keepalived to xci/playbook/roles, which setup haproxy service for kubernetes. Change-Id: I24d521a735d7ee85fbe5af8c4def65f37586b843 Signed-off-by: wutianwei <wutianwei1@huawei.com>
Diffstat (limited to 'xci/playbooks')
-rw-r--r--xci/playbooks/configure-localhost.yml100
1 files changed, 100 insertions, 0 deletions
diff --git a/xci/playbooks/configure-localhost.yml b/xci/playbooks/configure-localhost.yml
new file mode 100644
index 00000000..467ab312
--- /dev/null
+++ b/xci/playbooks/configure-localhost.yml
@@ -0,0 +1,100 @@
+---
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2017 Ericsson AB and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+- hosts: localhost
+ connection: local
+
+ pre_tasks:
+ - name: Load distribution variables
+ include_vars:
+ file: "{{ item }}"
+ failed_when: false
+ with_items:
+ - "{{ XCI_PATH }}/xci/var/opnfv.yml"
+ - "{{ XCI_PATH }}/xci/var/{{ ansible_os_family }}.yml"
+
+ - name: cleanup leftovers of previous deployment
+ file:
+ path: "{{ item }}"
+ state: absent
+ recurse: no
+ with_items:
+ - "{{ XCI_CACHE }}/repos"
+ - "{{ LOG_PATH }} "
+ - "{{ OPNFV_SSH_HOST_KEYS_PATH }}"
+
+ roles:
+ - role: clone-repository
+ project: "openstack/openstack-ansible-openstack_openrc"
+ repo: "{{ OPENSTACK_OSA_OPENRC_GIT_URL }}"
+ dest: roles/openstack-ansible-openstack_openrc
+ version: "master"
+ when: XCI_INSTALLER == "osa"
+ - role: clone-repository
+ project: "openstack/openstack-ansible"
+ repo: "{{ OPENSTACK_OSA_GIT_URL }}"
+ dest: "{{ XCI_CACHE }}/repos/openstack-ansible"
+ version: "{{ OPENSTACK_OSA_VERSION }}"
+ when: XCI_INSTALLER == "osa"
+ - role: clone-repository
+ project: "kubernetes-incubator/kubespray"
+ repo: "{{ KUBESPRAY_GIT_URL }}"
+ dest: "{{ XCI_CACHE }}/repos/kubespray"
+ version: "{{ KUBESPRAY_VERSION }}"
+ when: XCI_INSTALLER == "kubespray"
+ - role: clone-repository
+ project: "openstack/openstack-ansible-haproxy_server"
+ repo: "{{ OPENSTACK_OSA_HAPROXY_GIT_URL }}"
+ dest: roles/haproxy_server
+ version: "{{ HAPROXY_VERSION }}"
+ when:
+ - XCI_INSTALLER == "kubespray"
+ - role: clone-repository
+ project: "ansible-keepalived"
+ repo: "{{ KEEPALIVED_GIT_URL }}"
+ dest: roles/keepalived
+ version: "{{ KEEPALIVED_VERSION }}"
+ when:
+ - XCI_INSTALLER == "kubespray"
+
+ tasks:
+ - name: create log directory {{LOG_PATH}}
+ file:
+ path: "{{LOG_PATH}}"
+ state: directory
+ recurse: no
+ - block:
+ - name: check if certificate directory /etc/ssl/certs exists already
+ stat: path=/etc/ssl/certs
+ register: check_etc_ssl_certs
+ - name: create certificate directory /etc/ssl/certs
+ become: true
+ file:
+ path: "/etc/ssl/certs"
+ state: directory
+ when: check_etc_ssl_certs.stat.exists == false
+ - name: create key directory /etc/ssl/private
+ become: true
+ file:
+ path: "/etc/ssl/private"
+ state: directory
+ - name: generate self signed certificate
+ command: openssl req -new -nodes -x509 -subj "{{ XCI_SSL_SUBJECT }}" -days 3650 -keyout "/etc/ssl/private/xci.key" -out "/etc/ssl/certs/xci.crt" -extensions v3_ca
+ become: true
+ - name: Synchronize local development OSA repository to XCI paths
+ # command module is much faster than the copy module
+ synchronize:
+ src: "{{ OPENSTACK_OSA_DEV_PATH }}"
+ dest: "{{ XCI_CACHE }}/repos/openstack-ansible"
+ recursive: yes
+ delete: yes
+ when:
+ - OPENSTACK_OSA_DEV_PATH != ""
+ when:
+ - XCI_INSTALLER == "osa"