summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/build-aarch64.yaml3
-rwxr-xr-xci/deploy_ci.sh9
-rwxr-xr-xdeploy/adapters/ansible/kubernetes/ansible-kubernetes.yml12
-rw-r--r--deploy/adapters/ansible/kubernetes/roles/kargo/tasks/main.yml18
-rwxr-xr-xdeploy/compass_conf/flavor/kubernetes.conf2
-rwxr-xr-xdeploy/compass_conf/package_installer/ansible-kubernetes.conf2
-rwxr-xr-xdeploy/compass_conf/role/kubernetes_ansible.conf11
-rw-r--r--deploy/compass_conf/templates/ansible_installer/kubernetes/vars/ansible-kubernetes.tmpl1
-rw-r--r--deploy/conf/hardware_environment/huawei-pod1/k8-nosdn-stor4nfv-ha.yml74
-rw-r--r--deploy/conf/hardware_environment/huawei-pod2/k8-nosdn-nofeature-ha.yml73
-rw-r--r--deploy/conf/hardware_environment/huawei-pod2/k8-nosdn-stor4nfv-ha.yml79
-rw-r--r--deploy/conf/vm_environment/k8-nosdn-stor4nfv-ha.yml45
-rw-r--r--deploy/conf/vm_environment/k8-nosdn-stor4nfv-noha.yml28
-rw-r--r--docs/release/installation/k8s-deploy-arm.rst106
-rw-r--r--plugins/stor4nfv/plugin.desc45
-rw-r--r--plugins/stor4nfv/roles/stor4nfv/files/configure_vars.sh39
-rw-r--r--plugins/stor4nfv/roles/stor4nfv/files/install_ansible.sh18
-rw-r--r--plugins/stor4nfv/roles/stor4nfv/tasks/main.yml13
-rw-r--r--plugins/stor4nfv/roles/stor4nfv/tasks/opensds.yml84
-rw-r--r--plugins/stor4nfv/roles/stor4nfv/templates/ceph.hosts.j214
-rw-r--r--plugins/stor4nfv/roles/stor4nfv/templates/opensds.hosts.j29
21 files changed, 676 insertions, 9 deletions
diff --git a/build/build-aarch64.yaml b/build/build-aarch64.yaml
index e197f33b..84352284 100644
--- a/build/build-aarch64.yaml
+++ b/build/build-aarch64.yaml
@@ -15,8 +15,7 @@ packages:
get_method: docker
url: linaro/compass-deck:latest
- # XXX: only supports k8s now
- - name: compass-tasks
+ - name: compass-tasks-k8s
description: "compass task container for kubernets deployment via kargo"
get_method: docker
url: linaro/compass-tasks-k8s:latest
diff --git a/ci/deploy_ci.sh b/ci/deploy_ci.sh
index bd5adcc7..dd8786af 100755
--- a/ci/deploy_ci.sh
+++ b/ci/deploy_ci.sh
@@ -18,12 +18,13 @@ case $DEPLOY_SCENARIO in
echo "os-onos-sfc-ha scenario supports mitaka only"
exit 1
;;
- k8-nosdn-nofeature-ha)
- export COMPASS_OS_VERSION=centos7
- export KUBERNETES_VERSION="v1.7.3"
- ;;
esac
+if [[ "$DEPLOY_SCENARIO" =~ "k8-" ]]; then
+ export KUBERNETES_VERSION="v1.7.3"
+fi
+
+
if [[ "$NODE_NAME" =~ "intel-pod17" ]]; then
export USER_NAMESERVER=8.8.8.8
fi
diff --git a/deploy/adapters/ansible/kubernetes/ansible-kubernetes.yml b/deploy/adapters/ansible/kubernetes/ansible-kubernetes.yml
index bfdc8958..1eae8a97 100755
--- a/deploy/adapters/ansible/kubernetes/ansible-kubernetes.yml
+++ b/deploy/adapters/ansible/kubernetes/ansible-kubernetes.yml
@@ -42,3 +42,15 @@
max_fail_percentage: 0
roles:
- post-k8s
+
+- hosts: kube_node
+ remote_user: root
+ max_fail_percentage: 0
+ roles:
+ - storage
+
+- hosts: storage_master
+ remote_user: root
+ max_fail_percentage: 0
+ roles:
+ - stor4nfv
diff --git a/deploy/adapters/ansible/kubernetes/roles/kargo/tasks/main.yml b/deploy/adapters/ansible/kubernetes/roles/kargo/tasks/main.yml
index 187e2a52..6d947623 100644
--- a/deploy/adapters/ansible/kubernetes/roles/kargo/tasks/main.yml
+++ b/deploy/adapters/ansible/kubernetes/roles/kargo/tasks/main.yml
@@ -199,6 +199,24 @@
regexp: '"calico", "weave", "canal", "flannel"',
replace: '"calico", "weave", "canal", "flannel", "2flannel"'}
+# yamllint disable rule:line-length
+- name: enable CSI plugin feature
+ lineinfile:
+ dest: "/opt/kargo_k8s/roles/kubespray-defaults/defaults/main.yaml"
+ regexp: "^kube_feature_gates:"
+ line: "{% raw %}kube_feature_gates: ['Initializers={{ istio_enabled|string }}', 'PersistentLocalVolumes={{ local_volumes_enabled|string }}', 'CSIPersistentVolume=True', 'MountPropagation=True']{% endraw %}"
+ when:
+ - stor4nfv is defined and stor4nfv == "Enable"
+# yamllint enable rule:line-length
+
+- name: enable CSI plugin runtime_config
+ lineinfile:
+ dest: /opt/kargo_k8s/roles/kubernetes/master/defaults/main.yml
+ insertafter: '^ - admissionregistration.k8s.io/v1alpha1'
+ line: ' - storage.k8s.io/v1alpha1'
+ when:
+ - stor4nfv is defined and stor4nfv == "Enable"
+
- name: run kargo playbook
shell: |
cd /opt/kargo_k8s
diff --git a/deploy/compass_conf/flavor/kubernetes.conf b/deploy/compass_conf/flavor/kubernetes.conf
index 71acadff..e7e8ffc8 100755
--- a/deploy/compass_conf/flavor/kubernetes.conf
+++ b/deploy/compass_conf/flavor/kubernetes.conf
@@ -4,7 +4,7 @@ FLAVORS = [{
'display_name': 'ansible-kubernetes',
'template': 'ansible-kubernetes.tmpl',
'roles': [
- 'kube_master', 'etcd', 'kube_node', 'ha'
+ 'kube_master', 'etcd', 'kube_node', 'ha', 'storage_master', 'storage_node'
],
}]
diff --git a/deploy/compass_conf/package_installer/ansible-kubernetes.conf b/deploy/compass_conf/package_installer/ansible-kubernetes.conf
index 820691b7..044af9a9 100755
--- a/deploy/compass_conf/package_installer/ansible-kubernetes.conf
+++ b/deploy/compass_conf/package_installer/ansible-kubernetes.conf
@@ -7,7 +7,7 @@ SETTINGS = {
'playbook_file': 'site.yml',
'inventory_file': 'inventory.py',
'inventory_json_file': 'inventory.json',
- 'inventory_group': ['kube_master', 'etcd', 'kube_node', 'ha'],
+ 'inventory_group': ['kube_master', 'etcd', 'kube_node', 'ha', 'ceph_adm', 'ceph_mon', 'ceph_osd', 'storage_master', 'storage_node'],
'group_variable': 'all',
'etc_hosts_path': 'roles/pre-k8s/templates/hosts',
'runner_dirs': ['roles','kubernetes/roles']
diff --git a/deploy/compass_conf/role/kubernetes_ansible.conf b/deploy/compass_conf/role/kubernetes_ansible.conf
index c27779ad..3e79cbb9 100755
--- a/deploy/compass_conf/role/kubernetes_ansible.conf
+++ b/deploy/compass_conf/role/kubernetes_ansible.conf
@@ -15,6 +15,15 @@ ROLES = [{
'role': 'ha',
'display_name': 'ha',
'description': 'ha'
+}, {
+ 'role': 'storage_master',
+ 'display_name': 'storage master',
+ 'description': 'storage master',
+ 'optional': True
+}, {
+ 'role': 'storage_node',
+ 'display_name': 'storage node',
+ 'description': 'storage node',
+ 'optional': True
}
-
]
diff --git a/deploy/compass_conf/templates/ansible_installer/kubernetes/vars/ansible-kubernetes.tmpl b/deploy/compass_conf/templates/ansible_installer/kubernetes/vars/ansible-kubernetes.tmpl
index 59130fec..f6d96c78 100644
--- a/deploy/compass_conf/templates/ansible_installer/kubernetes/vars/ansible-kubernetes.tmpl
+++ b/deploy/compass_conf/templates/ansible_installer/kubernetes/vars/ansible-kubernetes.tmpl
@@ -40,6 +40,7 @@ deploy_type: $getVar('deploy_type', 'virtual')
public_cidr: $kube_nodes[0]['install']['subnet']
storage_cidr: "{{ ip_settings[inventory_hostname]['storage']['cidr'] }}"
mgmt_cidr: "{{ ip_settings[inventory_hostname]['mgmt']['cidr'] }}"
+external_cidr: "{{ ip_settings[inventory_hostname]['external']['cidr'] }}"
public_net_info: "{{ network_cfg.public_net_info }}"
host_ip_settings: "{{ ip_settings[inventory_hostname] }}"
diff --git a/deploy/conf/hardware_environment/huawei-pod1/k8-nosdn-stor4nfv-ha.yml b/deploy/conf/hardware_environment/huawei-pod1/k8-nosdn-stor4nfv-ha.yml
new file mode 100644
index 00000000..6cf62db7
--- /dev/null
+++ b/deploy/conf/hardware_environment/huawei-pod1/k8-nosdn-stor4nfv-ha.yml
@@ -0,0 +1,74 @@
+##############################################################################
+# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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
+##############################################################################
+
+---
+TYPE: baremetal
+FLAVOR: cluster
+POWER_TOOL: ipmitool
+
+ipmiUser: root
+ipmiVer: '2.0'
+
+plugins:
+ - stor4nfv: "Enable"
+
+hosts:
+ - name: host1
+ mac: 'F8:4A:BF:55:A2:8D'
+ interfaces:
+ - eth1: 'F8:4A:BF:55:A2:8E'
+ ipmiIp: 172.16.130.26
+ ipmiPass: Opnfv@pod1
+ roles:
+ - kube_master
+ - etcd
+ - ha
+
+ - name: host2
+ mac: 'D8:49:0B:DA:5A:B7'
+ interfaces:
+ - eth1: 'D8:49:0B:DA:5A:B8'
+ ipmiIp: 172.16.130.27
+ ipmiPass: Opnfv@pod1
+ roles:
+ - kube_master
+ - etcd
+ - ha
+
+ - name: host3
+ mac: '78:D7:52:A0:B1:99'
+ interfaces:
+ - eth1: '78:D7:52:A0:B1:9A'
+ ipmiIp: 172.16.130.29
+ ipmiPass: Opnfv@pod1
+ roles:
+ - kube_master
+ - etcd
+ - ha
+ - storage_master
+
+ - name: host4
+ mac: 'D8:49:0B:DA:5B:5D'
+ interfaces:
+ - eth1: 'D8:49:0B:DA:5B:5E'
+ ipmiIp: 172.16.130.30
+ ipmiPass: Opnfv@pod1
+ roles:
+ - kube_node
+ - storage_node
+
+ - name: host5
+ mac: 'D8:49:0B:DA:56:85'
+ interfaces:
+ - eth1: 'D8:49:0B:DA:56:86'
+ ipmiIp: 172.16.130.31
+ ipmiPass: Opnfv@pod1
+ roles:
+ - kube_node
+ - storage_node
diff --git a/deploy/conf/hardware_environment/huawei-pod2/k8-nosdn-nofeature-ha.yml b/deploy/conf/hardware_environment/huawei-pod2/k8-nosdn-nofeature-ha.yml
new file mode 100644
index 00000000..a96a5259
--- /dev/null
+++ b/deploy/conf/hardware_environment/huawei-pod2/k8-nosdn-nofeature-ha.yml
@@ -0,0 +1,73 @@
+##############################################################################
+# Copyright (c) 2018 HUAWEI TECHNOLOGIES CO.,LTD 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
+##############################################################################
+
+---
+
+TYPE: baremetal
+FLAVOR: cluster
+POWER_TOOL: ipmitool
+
+ipmiVer: '2.0'
+
+hosts:
+ - name: host1
+ mac: 'EC:38:8F:79:0C:2C'
+ ipmiUser: root
+ ipmiPass: Opnfv@pod2
+ ipmiIp: 172.16.130.20
+ interfaces:
+ - eth1: 'EC:38:8F:79:0C:2D'
+ roles:
+ - kube_master
+ - etcd
+ - ha
+
+ - name: host2
+ mac: 'EC:38:8F:79:0C:48'
+ ipmiIp: 172.16.130.19
+ ipmiUser: root
+ ipmiPass: Opnfv@pod2
+ interfaces:
+ - eth1: 'EC:38:8F:79:0C:49'
+ roles:
+ - kube_master
+ - etcd
+ - ha
+
+ - name: host3
+ mac: 'EC:38:8F:79:10:CC'
+ ipmiIp: 172.16.130.18
+ ipmiUser: root
+ ipmiPass: Opnfv@pod2
+ interfaces:
+ - eth1: 'EC:38:8F:79:10:CD'
+ roles:
+ - kube_master
+ - etcd
+ - ha
+
+ - name: host4
+ mac: 'EC:38:8F:79:0C:6C'
+ ipmiIp: 172.16.130.17
+ ipmiUser: root
+ ipmiPass: Opnfv@pod2
+ interfaces:
+ - eth1: 'EC:38:8F:79:0C:6D'
+ roles:
+ - kube_node
+
+ - name: host5
+ mac: 'EC:38:8F:7A:E6:ED'
+ ipmiIp: 172.16.130.16
+ ipmiUser: root
+ ipmiPass: Opnfv@pod2
+ interfaces:
+ - eth1: 'EC:38:8F:7A:E6:EE'
+ roles:
+ - kube_node
diff --git a/deploy/conf/hardware_environment/huawei-pod2/k8-nosdn-stor4nfv-ha.yml b/deploy/conf/hardware_environment/huawei-pod2/k8-nosdn-stor4nfv-ha.yml
new file mode 100644
index 00000000..4fbea1f0
--- /dev/null
+++ b/deploy/conf/hardware_environment/huawei-pod2/k8-nosdn-stor4nfv-ha.yml
@@ -0,0 +1,79 @@
+##############################################################################
+# Copyright (c) 2018 HUAWEI TECHNOLOGIES CO.,LTD 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
+##############################################################################
+
+---
+
+TYPE: baremetal
+FLAVOR: cluster
+POWER_TOOL: ipmitool
+
+ipmiVer: '2.0'
+
+plugins:
+ - stor4nfv: "Enable"
+
+hosts:
+ - name: host1
+ mac: 'EC:38:8F:79:0C:2C'
+ ipmiUser: root
+ ipmiPass: Opnfv@pod2
+ ipmiIp: 172.16.130.20
+ interfaces:
+ - eth1: 'EC:38:8F:79:0C:2D'
+ roles:
+ - kube_master
+ - etcd
+ - ha
+
+ - name: host2
+ mac: 'EC:38:8F:79:0C:48'
+ ipmiIp: 172.16.130.19
+ ipmiUser: root
+ ipmiPass: Opnfv@pod2
+ interfaces:
+ - eth1: 'EC:38:8F:79:0C:49'
+ roles:
+ - kube_master
+ - etcd
+ - ha
+
+ - name: host3
+ mac: 'EC:38:8F:79:10:CC'
+ ipmiIp: 172.16.130.18
+ ipmiUser: root
+ ipmiPass: Opnfv@pod2
+ interfaces:
+ - eth1: 'EC:38:8F:79:10:CD'
+ roles:
+ - kube_master
+ - etcd
+ - ha
+ - storage_master
+
+ - name: host4
+ mac: 'EC:38:8F:79:0C:6C'
+ ipmiIp: 172.16.130.17
+ ipmiUser: root
+ ipmiPass: Opnfv@pod2
+ interfaces:
+ - eth1: 'EC:38:8F:79:0C:6D'
+ roles:
+ - kube_node
+ - storage_node
+
+ - name: host5
+ mac: 'EC:38:8F:7A:E6:ED'
+ ipmiIp: 172.16.130.16
+ ipmiUser: root
+ ipmiPass: Opnfv@pod2
+ interfaces:
+ - eth1: 'EC:38:8F:7A:E6:EE'
+ roles:
+ - kube_node
+ - storage_node
diff --git a/deploy/conf/vm_environment/k8-nosdn-stor4nfv-ha.yml b/deploy/conf/vm_environment/k8-nosdn-stor4nfv-ha.yml
new file mode 100644
index 00000000..e5e458f7
--- /dev/null
+++ b/deploy/conf/vm_environment/k8-nosdn-stor4nfv-ha.yml
@@ -0,0 +1,45 @@
+##############################################################################
+# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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
+##############################################################################
+
+---
+TYPE: virtual
+FLAVOR: cluster
+
+plugins:
+ - stor4nfv: "Enable"
+
+hosts:
+ - name: host1
+ roles:
+ - kube_master
+ - etcd
+ - ha
+
+ - name: host2
+ roles:
+ - kube_master
+ - etcd
+ - ha
+
+ - name: host3
+ roles:
+ - kube_master
+ - etcd
+ - ha
+ - storage_master
+
+ - name: host4
+ roles:
+ - kube_node
+ - storage_node
+
+ - name: host5
+ roles:
+ - kube_node
+ - storage_node
diff --git a/deploy/conf/vm_environment/k8-nosdn-stor4nfv-noha.yml b/deploy/conf/vm_environment/k8-nosdn-stor4nfv-noha.yml
new file mode 100644
index 00000000..f8c29b3e
--- /dev/null
+++ b/deploy/conf/vm_environment/k8-nosdn-stor4nfv-noha.yml
@@ -0,0 +1,28 @@
+##############################################################################
+# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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
+##############################################################################
+
+---
+TYPE: virtual
+FLAVOR: cluster
+
+plugins:
+ - stor4nfv: "Enable"
+
+hosts:
+ - name: host1
+ roles:
+ - kube_master
+ - etcd
+ - storage_master
+ - ha
+
+ - name: host2
+ roles:
+ - kube_node
+ - storage_node
diff --git a/docs/release/installation/k8s-deploy-arm.rst b/docs/release/installation/k8s-deploy-arm.rst
new file mode 100644
index 00000000..b5b54c20
--- /dev/null
+++ b/docs/release/installation/k8s-deploy-arm.rst
@@ -0,0 +1,106 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International Licence.
+.. http://creativecommons.org/licenses/by/4.0
+.. (c) by Yibo Cai (Arm)
+
+Validated platform
+==================
+
+================ ========= ================ ========
+ Jump server Node
+--------------------------- --------------------------
+distro libvirt distro k8s
+================ ========= ================ ========
+ubuntu 16.04.3 1.3.1 centos7 1708 1.7.5
+================ ========= ================ ========
+
+Prepare jump server
+===================
+This document assumes you are using a baremetal Arm server as Compass4NFV jump server. It's possible to deploy jump server inside a virtual machine, this case is not covered here.
+
+#. Install Ubuntu 16.04.3 aarch64 on jump server.
+
+#. Install required packages.
+
+ .. code-block:: bash
+
+ $ sudo apt install docker.io libvirt-bin virt-manager qemu qemu-efi
+
+#. Disable DHCP of default libvirt network.
+
+ Libvirt creates a default network at intallation, which enables DHCP and occupies port 67. It conflicts with compass-cobbler container.
+
+ .. code-block:: bash
+
+ $ sudo virsh net-edit default
+
+ .. code-block:: xml
+
+ <!-- remove below lines and save/quit ->
+ <dhcp>
+ <range start='192.168.122.2' end='192.168.122.254'/>
+ </dhcp>
+
+ .. code-block:: bash
+
+ $ sudo virsh net-destroy default
+ $ sudo virsh net-start default
+
+#. Make sure ports 67, 69, 80, 443 are free.
+
+ Compass-cobber requires ports 67, 69 to provide DHCP and TFTP services. Compass-deck provides HTTP and HTTPS through ports 80, 443. All these ports should be free before deployment.
+
+#. Tear down apparmor service.
+
+ .. code-block:: bash
+
+ $ sudo service apparmor teardown
+
+#. Enable password-less sudo for current user (optional).
+
+
+Build Arm tarball
+=================
+
+Clone Compass4NFV code. Run below command to build deployment tarball for Arm.
+
+.. code-block:: bash
+
+ $ COMPASS_ISO_REPO='http://people.linaro.org/~yibo.cai/compass' ./build.sh
+
+It downloads and archives Ubuntu/CentOS installation ISO and Compass core docker images for later deployment.
+
+
+Deploy K8s in VM
+================
+This section introduces the steps to deploy K8s cluster in virtual machines running on jump server. Two VM nodes will be created, one master and one minion, with flannel networking.
+
+Clear old Compass core
+----------------------
+
+Compass core consists of five containers which are responsible for deploying K8s clusters.
+
+- *compass-deck*: provides API service and web UI
+- *compass-tasks*: deploy K8s to nodes
+- *compass-cobbler*: deploy OS to nodes
+- *compass-db*: mysql service
+- *compass-mq*: rabbitmq service
+
+Run below command to remove running Compass containers for a clean deployment.
+
+.. code-block:: bash
+
+ $ docker rm -f `docker ps | grep compass | cut -f1 -d' '`
+
+Deploy OS and K8s
+-----------------
+To deploy OS and K8s on two virtual nodes, run:
+
+.. code-block:: bash
+
+ $ ADAPTER_OS_PATTERN='(?i)CentOS-7.*arm.*' \
+ OS_VERSION=centos7 \
+ KUBERNETES_VERSION=v1.7.5 \
+ DHA=${PWD}/deploy/conf/vm_environment/k8-nosdn-nofeature-noha.yml \
+ NETWORK=${PWD}/deploy/conf/vm_environment/network.yml \
+ VIRT_NUMBER=2 VIRT_CPUS=4 VIRT_MEM=8192 VIRT_DISK=50G \
+ ./deploy.sh
diff --git a/plugins/stor4nfv/plugin.desc b/plugins/stor4nfv/plugin.desc
new file mode 100644
index 00000000..ae589a60
--- /dev/null
+++ b/plugins/stor4nfv/plugin.desc
@@ -0,0 +1,45 @@
+# Plugin for Stor4nfv service for Compass4nfv.
+# Stor4NFV provides a storage solution based on Ceph and
+# OpenSDS, and focuses on the optimization for storage
+# intensive use cases of NFV, like I/O performance improvements.
+#
+# More details can be found in the development document.
+# ##############################################################
+---
+plugin:
+ # plugin name,it is also as the switch to enable/disable plugin in scenario
+ # files
+ name: stor4nfv
+
+ description: provide a storage solution based on Ceph and OpenSDS
+
+ maintainers:
+
+ # host os type: ubuntu/centos
+ os_version: ubuntu
+
+ # true: this plugin is deployed separately on a new node
+ # false: this plugin is deployed on controller or compute node
+ independent_hosts: false
+
+ # artifact: package download url for this plugin
+ artifacts:
+ url:
+
+ # orchestration
+ # A plugin can have mutiple components, each component may need to be
+ # installed on different inventory or have its own configuration.
+ # due to Compass4nfv currently only supports ansible, so each component
+ # of the installation and configuration script need to be use ansible.
+ # cm : congfiguration management tool : only ansible support
+ # role: each component corresponds to ansible script that locates in the same
+ # directory as plugin.desc.
+ # phrase:
+ # inventory:
+ orchestration:
+ cm: ansible
+ roles:
+ - role: stor4nfv
+ phrase: post_k8s
+ inventory:
+ - localhost
diff --git a/plugins/stor4nfv/roles/stor4nfv/files/configure_vars.sh b/plugins/stor4nfv/roles/stor4nfv/files/configure_vars.sh
new file mode 100644
index 00000000..878f1542
--- /dev/null
+++ b/plugins/stor4nfv/roles/stor4nfv/files/configure_vars.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+# #############################################################################
+# Copyright (c) 2018 Intel Corp.
+#
+# 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
+# #############################################################################
+
+cd $HOME/gopath/src/github.com/stor4nfv/stor4nfv/ci/ansible
+
+sed -i 's/^workplace.*/workplace: \/root/g' group_vars/common.yml
+
+sed -i 's/^enabled_backend.*/enabled_backend: ceph/g' group_vars/osdsdock.yml
+
+sed -i 's/^ceph_pool_name.*/ceph_pool_name: "rbd"/g' group_vars/osdsdock.yml
+
+sed -i 's/^ceph_origin.*/ceph_origin: repository/g' group_vars/ceph/all.yml
+
+sed -i 's/^ceph_repository.*/ceph_repository: community/g' group_vars/ceph/all.yml
+
+sed -i 's/^ceph_stable_release.*/ceph_stable_release: luminous/g' group_vars/ceph/all.yml
+
+sed -i 's|^public_network.*|public_network: '"$1"'|g' group_vars/ceph/all.yml
+
+sed -i 's|^cluster_network.*|cluster_network: '"$2"'|g' group_vars/ceph/all.yml
+
+sed -i 's/^monitor_interface.*/monitor_interface: eth0/g' group_vars/ceph/all.yml
+
+sed -i 's/^devices:.*/devices: [\/dev\/loop0, \/dev\/loop1, \/dev\/loop2]/g' group_vars/ceph/osds.yml
+
+sed -i 's/^osd_scenario.*/osd_scenario: collocated/g' group_vars/ceph/osds.yml
+
+sed -i 's/^db_endpoint.*/db_endpoint: localhost:62379,localhost:62380/g' group_vars/osdsdb.yml
+
+sed -i 's/^etcd_port.*/etcd_port: 62379/g' group_vars/osdsdb.yml
+
+sed -i 's/^etcd_peer_port.*/etcd_peer_port: 62380/g' group_vars/osdsdb.yml
diff --git a/plugins/stor4nfv/roles/stor4nfv/files/install_ansible.sh b/plugins/stor4nfv/roles/stor4nfv/files/install_ansible.sh
new file mode 100644
index 00000000..b4a3a30a
--- /dev/null
+++ b/plugins/stor4nfv/roles/stor4nfv/files/install_ansible.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+# #############################################################################
+# Copyright (c) 2018 Intel Corp.
+#
+# 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
+# #############################################################################
+
+add-apt-repository ppa:ansible/ansible
+
+apt-get update
+apt-get install -y ansible
+sleep 5
+
+ansible --version
+
diff --git a/plugins/stor4nfv/roles/stor4nfv/tasks/main.yml b/plugins/stor4nfv/roles/stor4nfv/tasks/main.yml
new file mode 100644
index 00000000..353282f9
--- /dev/null
+++ b/plugins/stor4nfv/roles/stor4nfv/tasks/main.yml
@@ -0,0 +1,13 @@
+# #############################################################################
+# Copyright (c) 2018 Intel Corp.
+#
+# 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
+# #############################################################################
+---
+- include: opensds.yml
+ when:
+ - ansible_distribution == 'Ubuntu'
+ - stor4nfv is defined and stor4nfv == "Enable"
diff --git a/plugins/stor4nfv/roles/stor4nfv/tasks/opensds.yml b/plugins/stor4nfv/roles/stor4nfv/tasks/opensds.yml
new file mode 100644
index 00000000..afd65bc7
--- /dev/null
+++ b/plugins/stor4nfv/roles/stor4nfv/tasks/opensds.yml
@@ -0,0 +1,84 @@
+# #############################################################################
+# Copyright (c) 2018 Intel Corp.
+#
+# 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
+# #############################################################################
+---
+
+- name: install prerequisites package
+ apt:
+ name: "{{ item }}"
+ state: present
+ with_items:
+ - make
+ - gcc
+
+- name: copy install_ansible script
+ remote_user: root
+ copy:
+ src: install_ansible.sh
+ dest: /opt/install_ansible.sh
+ mode: 0777
+
+- name: install ansible
+ command: su -s /bin/sh -c "/opt/install_ansible.sh"
+
+- name: install ceph-ansible code
+ remote_user: root
+ shell: |
+ cd /opt;
+ git clone https://github.com/ceph/ceph-ansible.git
+
+- name: fetch stor4nfv source code
+ remote_user: root
+ shell: |
+ mkdir -p $HOME/gopath/src/github.com/stor4nfv && cd $HOME/gopath/src/github.com/stor4nfv;
+ git clone https://gerrit.opnfv.org/gerrit/stor4nfv.git
+
+- name: copy configure_vars script
+ remote_user: root
+ copy:
+ src: configure_vars.sh
+ dest: /opt/configure_vars.sh
+ mode: 0777
+
+- name: configure variables for ceph, opensds
+ remote_user: root
+ shell: |
+ cd /opt;
+ ./configure_vars.sh {{ mgmt_cidr }} {{ external_cidr }}
+
+- name: render ceph inventory
+ remote_user: root
+ template:
+ src: ceph.hosts.j2
+ dest: $HOME/gopath/src/github.com/stor4nfv/stor4nfv/ci/ansible/group_vars/ceph/ceph.hosts
+
+- name: render opensds inventory
+ remote_user: root
+ template:
+ src: opensds.hosts.j2
+ dest: $HOME/gopath/src/github.com/stor4nfv/stor4nfv/ci/ansible/local.hosts
+
+- name: force to run the second etcd cluster
+ remote_user: root
+ lineinfile:
+ dest: $HOME/gopath/src/github.com/stor4nfv/stor4nfv/ci/ansible/roles/osdsdb/scenarios/etcd.yml
+ state: absent
+ regexp: 'when: service_etcd_status.rc != 0'
+
+- name: run playbook
+ remote_user: root
+ shell: |
+ cd $HOME/gopath/src/github.com/stor4nfv/stor4nfv/ci/ansible;
+ ansible-playbook site.yml -i local.hosts | tee /var/log/stor4nfv.log
+ register: stor4nfv_result
+
+- name: export opensds endpoint
+ remote_user: root
+ shell: |
+ export OPENSDS_ENDPOINT=http://127.0.0.1:50040
+ when: stor4nfv_result|succeeded
diff --git a/plugins/stor4nfv/roles/stor4nfv/templates/ceph.hosts.j2 b/plugins/stor4nfv/roles/stor4nfv/templates/ceph.hosts.j2
new file mode 100644
index 00000000..fda313d4
--- /dev/null
+++ b/plugins/stor4nfv/roles/stor4nfv/templates/ceph.hosts.j2
@@ -0,0 +1,14 @@
+[mons]
+{% for controller in hostvars[inventory_hostname]['groups']['kube_master'] %}
+{{ controller }} ansible_ssh_host={{ hostvars[controller]['ansible_ssh_host'] }}
+{% endfor %}
+
+[osds]
+{% for controller in hostvars[inventory_hostname]['groups']['storage_node'] %}
+{{ controller }} ansible_ssh_host={{ hostvars[controller]['ansible_ssh_host'] }}
+{% endfor %}
+
+[mgrs]
+{% for controller in hostvars[inventory_hostname]['groups']['kube_master'] %}
+{{ controller }} ansible_ssh_host={{ hostvars[controller]['ansible_ssh_host'] }}
+{% endfor %}
diff --git a/plugins/stor4nfv/roles/stor4nfv/templates/opensds.hosts.j2 b/plugins/stor4nfv/roles/stor4nfv/templates/opensds.hosts.j2
new file mode 100644
index 00000000..97068b90
--- /dev/null
+++ b/plugins/stor4nfv/roles/stor4nfv/templates/opensds.hosts.j2
@@ -0,0 +1,9 @@
+[controllers]
+{% for controller in hostvars[inventory_hostname]['groups']['storage_master'] %}
+{{ controller }} ansible_ssh_host={{ hostvars[controller]['ansible_ssh_host'] }}
+{% endfor %}
+
+[docks]
+{% for dock in hostvars[inventory_hostname]['groups']['storage_master'] %}
+{{ dock }} ansible_ssh_host={{ hostvars[dock]['ansible_ssh_host'] }}
+{% endfor %}