summaryrefslogtreecommitdiffstats
path: root/plugins/opencontrail
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/opencontrail')
-rw-r--r--plugins/opencontrail/plugin.desc43
-rw-r--r--plugins/opencontrail/roles/install-k8s-opencontrail/files/bms-instances.yaml32
-rw-r--r--plugins/opencontrail/roles/install-k8s-opencontrail/files/kvm-instances.yaml32
-rw-r--r--plugins/opencontrail/roles/install-k8s-opencontrail/files/mirrors.repo32
-rw-r--r--plugins/opencontrail/roles/install-k8s-opencontrail/files/mirrors_aarch64.repo22
-rw-r--r--plugins/opencontrail/roles/install-k8s-opencontrail/tasks/main.yml92
6 files changed, 253 insertions, 0 deletions
diff --git a/plugins/opencontrail/plugin.desc b/plugins/opencontrail/plugin.desc
new file mode 100644
index 00000000..82ccd5ee
--- /dev/null
+++ b/plugins/opencontrail/plugin.desc
@@ -0,0 +1,43 @@
+# Plugin for opencontrail service for Compass4nfv.
+# opencontrail provides a sdn network for k8s.
+#
+# 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: opencontrail
+
+ description: provide a sdn solution for k8s
+
+ maintainers:
+
+ # host os type: centos
+ os_version: centos
+
+ # 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: opencontrail
+ phrase: post_k8s
+ inventory:
+ - localhost
diff --git a/plugins/opencontrail/roles/install-k8s-opencontrail/files/bms-instances.yaml b/plugins/opencontrail/roles/install-k8s-opencontrail/files/bms-instances.yaml
new file mode 100644
index 00000000..7fb70374
--- /dev/null
+++ b/plugins/opencontrail/roles/install-k8s-opencontrail/files/bms-instances.yaml
@@ -0,0 +1,32 @@
+---
+provider_config:
+ bms:
+ ssh_pwd: root
+ ssh_user: root
+ ssh_public_key: /root/.ssh/id_rsa.pub
+ ssh_private_key: /root/.ssh/id_rsa
+ domainsuffix: local
+instances:
+ bms1:
+ provider: bms
+ roles:
+ config_database:
+ config:
+ control:
+ analytics_database:
+ analytics:
+ webui:
+ k8s_master:
+ kubemanager:
+ ip: 192.16.1.211
+ bms2:
+ provider: bms
+ roles:
+ k8s_node:
+ vrouter:
+ ip: 192.16.1.212
+
+contrail_configuration:
+ CONTAINER_REGISTRY: opencontrailnightly
+ CONTRAIL_VERSION: latest
+ KUBERNETES_CLUSTER_PROJECT: {}
diff --git a/plugins/opencontrail/roles/install-k8s-opencontrail/files/kvm-instances.yaml b/plugins/opencontrail/roles/install-k8s-opencontrail/files/kvm-instances.yaml
new file mode 100644
index 00000000..b2f9e6dd
--- /dev/null
+++ b/plugins/opencontrail/roles/install-k8s-opencontrail/files/kvm-instances.yaml
@@ -0,0 +1,32 @@
+---
+provider_config:
+ kvm:
+ ssh_pwd: root
+ ssh_user: root
+ ssh_public_key: /root/.ssh/id_rsa.pub
+ ssh_private_key: /root/.ssh/id_rsa
+ domainsuffix: local
+instances:
+ kvm1:
+ provider: kvm
+ roles:
+ config_database:
+ config:
+ control:
+ analytics_database:
+ analytics:
+ webui:
+ k8s_master:
+ kubemanager:
+ ip: 10.1.0.50
+ kvm2:
+ provider: kvm
+ roles:
+ k8s_node:
+ vrouter:
+ ip: 10.1.0.51
+
+contrail_configuration:
+ CONTAINER_REGISTRY: opencontrailnightly
+ CONTRAIL_VERSION: latest
+ KUBERNETES_CLUSTER_PROJECT: {}
diff --git a/plugins/opencontrail/roles/install-k8s-opencontrail/files/mirrors.repo b/plugins/opencontrail/roles/install-k8s-opencontrail/files/mirrors.repo
new file mode 100644
index 00000000..4900db69
--- /dev/null
+++ b/plugins/opencontrail/roles/install-k8s-opencontrail/files/mirrors.repo
@@ -0,0 +1,32 @@
+[base]
+name=CentOS-$releasever - Base
+mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
+#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
+
+#released updates
+[updates]
+name=CentOS-$releasever - Updates
+mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
+#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
+
+#additional packages that may be useful
+[extras]
+name=CentOS-$releasever - Extras
+mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
+#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
+
+#additional packages that extend functionality of existing packages
+[centosplus]
+name=CentOS-$releasever - Plus
+mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
+#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
+gpgcheck=1
+enabled=0
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
+
diff --git a/plugins/opencontrail/roles/install-k8s-opencontrail/files/mirrors_aarch64.repo b/plugins/opencontrail/roles/install-k8s-opencontrail/files/mirrors_aarch64.repo
new file mode 100644
index 00000000..1d622d3c
--- /dev/null
+++ b/plugins/opencontrail/roles/install-k8s-opencontrail/files/mirrors_aarch64.repo
@@ -0,0 +1,22 @@
+[base]
+name=CentOS-$releasever - Base
+baseurl=http://mirror.centos.org/altarch/$releasever/os/$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
+ file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64
+
+#released updates
+[updates]
+name=CentOS-$releasever - Updates
+baseurl=http://mirror.centos.org/altarch/$releasever/updates/$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
+ file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64
+
+#additional packages that may be useful
+[extras]
+name=CentOS-$releasever - Extras
+baseurl=http://mirror.centos.org/altarch/$releasever/extras/$basearch/
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
+ file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64
diff --git a/plugins/opencontrail/roles/install-k8s-opencontrail/tasks/main.yml b/plugins/opencontrail/roles/install-k8s-opencontrail/tasks/main.yml
new file mode 100644
index 00000000..712ebfa7
--- /dev/null
+++ b/plugins/opencontrail/roles/install-k8s-opencontrail/tasks/main.yml
@@ -0,0 +1,92 @@
+##############################################################################
+# 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
+##############################################################################
+---
+- name: clean local repo conf
+ file:
+ path: /etc/yum.repos.d
+ state: absent
+ run_once: "True"
+ when: ansible_os_family == 'RedHat'
+
+- name: create local repo conf dir
+ file:
+ path: /etc/yum.repos.d
+ state: directory
+ run_once: "True"
+ when: ansible_os_family == 'RedHat'
+
+- name: configure local mirror repo
+ copy:
+ src: "{{ item }}"
+ dest: /etc/yum.repos.d/mirrors.repo
+ with_first_found:
+ - mirrors_{{ ansible_architecture }}.repo
+ - mirrors.repo
+ run_once: "True"
+ when: ansible_os_family == 'RedHat'
+
+- name: clean local pip conf to use official pip repo
+ file:
+ path: /root/.pip/pip.conf
+ state: absent
+ run_once: "True"
+
+- name: install dependency for ansible update
+ yum:
+ name: "{{ item }}"
+ state: latest
+ with_items:
+ - git
+ - libffi-devel
+ - openssl-devel
+ - python-devel
+ run_once: "True"
+ when: ansible_os_family == 'RedHat'
+
+- name: update python packages
+ pip:
+ name: "{{ item }}"
+ state: latest
+ with_items:
+ - netaddr
+ - jinja2
+
+- name: git clone contrail-ansible-deployer repo
+ shell: |
+ rm -rf /opt/contrail-ansible-deployer
+ git clone https://github.com/Juniper/contrail-ansible-deployer.git \
+ /opt/contrail-ansible-deployer
+
+- name: copy overrided variables
+ copy:
+ src: "{{ item }}"
+ dest: /opt/contrail-ansible-deployer/config/instances.yaml
+ with_first_found:
+ - kvm-instances.yaml
+
+- name: do not restart network
+ shell: |
+ cd /opt/contrail-ansible-deployer
+ sed -i '9, 13d' playbooks/roles/configure_instances/tasks/RedHat.yml
+
+- name: run config playbook
+ shell: |
+ cd /opt/contrail-ansible-deployer
+ ansible-playbook -i inventory/ playbooks/configure_instances.yml \
+ -b -v 2>&1 | tee config-contrail.log
+ tags:
+ - ansible
+
+- name: run install playbook
+ shell: |
+ cd /opt/contrail-ansible-deployer
+ ansible-playbook -e orchestrator=kubernetes -i inventory/ playbooks/install_contrail.yml \
+ -b -v 2>&1 | tee install-contrail.log
+ tags:
+ - ansible