remote_user: root
max_fail_percentage: 0
roles:
- - kargo
+ - role: kargo
+ when: opencontrail is not defined
+ - role: install-k8s-opencontrail
+ when: opencontrail is defined and opencontrail == "Enable"
- hosts: kube_master
remote_user: root
'display_name': 'ansible-kubernetes',
'template': 'ansible-kubernetes.tmpl',
'roles': [
- 'kube_master', 'etcd', 'kube_node', 'ha', 'storage_master', 'storage_node'
+ 'kube_master', 'etcd', 'kube_node', 'ha', 'storage_master', 'storage_node', 'opencontrail'
],
}]
-
-
'display_name': 'kube node',
'description': 'kube Node'
}, {
+ 'role': 'opencontrail',
+ 'display_name': 'opencontrail node',
+ 'description': 'opencontrail node'
+},{
'role': 'ha',
'display_name': 'ha',
'description': 'ha'
--- /dev/null
+##############################################################################
+# 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:
+ - opencontrail: "Enable"
+
+hosts:
+ - name: host1
+ roles:
+ - kube_master
+ - etcd
+ - opencontrail
+ - ha
+
+ - name: host2
+ roles:
+ - kube_node
--- /dev/null
+# 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
--- /dev/null
+---
+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: {}
--- /dev/null
+---
+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: {}
--- /dev/null
+[base]\r
+name=CentOS-$releasever - Base\r
+mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra\r
+#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/\r
+gpgcheck=1\r
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7\r
+\r
+#released updates\r
+[updates]\r
+name=CentOS-$releasever - Updates\r
+mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra\r
+#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/\r
+gpgcheck=1\r
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7\r
+\r
+#additional packages that may be useful\r
+[extras]\r
+name=CentOS-$releasever - Extras\r
+mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra\r
+#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/\r
+gpgcheck=1\r
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7\r
+\r
+#additional packages that extend functionality of existing packages\r
+[centosplus]\r
+name=CentOS-$releasever - Plus\r
+mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra\r
+#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/\r
+gpgcheck=1\r
+enabled=0\r
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7\r
+\r
--- /dev/null
+[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
--- /dev/null
+##############################################################################
+# 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