diff options
Diffstat (limited to 'plugins')
9 files changed, 264 insertions, 6 deletions
diff --git a/plugins/barometer/roles/grafana/files/install_grafana.sh b/plugins/barometer/roles/grafana/files/install_grafana.sh index 0b9f4ec5..43d9a588 100644 --- a/plugins/barometer/roles/grafana/files/install_grafana.sh +++ b/plugins/barometer/roles/grafana/files/install_grafana.sh @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -echo "deb https://packagecloud.io/grafana/stable/debian/ wheezy main" | tee /etc/apt/sources.list.d/grafana.list +echo "deb https://packagecloud.io/grafana/stable/debian/ stretch main" | tee /etc/apt/sources.list.d/grafana.list curl https://packagecloud.io/gpg.key | apt-key add - 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 diff --git a/plugins/stor4nfv/roles/stor4nfv/tasks/opensds.yml b/plugins/stor4nfv/roles/stor4nfv/tasks/opensds.yml index a095ceb0..3252fefb 100644 --- a/plugins/stor4nfv/roles/stor4nfv/tasks/opensds.yml +++ b/plugins/stor4nfv/roles/stor4nfv/tasks/opensds.yml @@ -30,7 +30,8 @@ remote_user: root shell: | cd /opt; - git clone https://github.com/ceph/ceph-ansible.git + git clone https://github.com/ceph/ceph-ansible.git; + [ -f ceph-ansible/requirements.txt ] && pip install -r ceph-ansible/requirements.txt - name: fetch stor4nfv source code remote_user: root diff --git a/plugins/stor4nfv/roles/stor4nfv/tasks/post-install.yml b/plugins/stor4nfv/roles/stor4nfv/tasks/post-install.yml index 55d26d69..182c0a68 100644 --- a/plugins/stor4nfv/roles/stor4nfv/tasks/post-install.yml +++ b/plugins/stor4nfv/roles/stor4nfv/tasks/post-install.yml @@ -8,6 +8,10 @@ # ############################################################################# --- +- name: define image architecture + set_fact: + imgarch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}" + - name: ensure ceph-ansible dir exists stat: path: /opt/ceph-ansible @@ -39,24 +43,24 @@ - name: ensure osdsctl exists stat: - path: /opt/opensds-v0.1.5-linux-amd64/bin/osdsctl + path: /opt/opensds-v0.1.5-linux-{{ imgarch }}/bin/osdsctl ignore_errors: "true" register: osdsctl_exists - name: ensure opensds csi directory exists stat: - path: /opt/opensds-k8s-v0.1.0-linux-amd64 + path: /opt/opensds-k8s-v0.1.0-linux-{{ imgarch }} ignore_errors: "true" register: csi_dir_exists - name: create opensds default profile, csi pods remote_user: root shell: | - cp /opt/opensds-v0.1.5-linux-amd64/bin/osdsctl /usr/local/bin; + cp /opt/opensds-v0.1.5-linux-{{ imgarch }}/bin/osdsctl /usr/local/bin; export OPENSDS_ENDPOINT=http://{{ public_vip.ip }}:50040; export OPENSDS_AUTH_STRATEGY=noauth; osdsctl profile create '{"name": "default", "description": "default policy"}' - cd /opt/opensds-k8s-v0.1.0-linux-amd64; + cd /opt/opensds-k8s-v0.1.0-linux-{{ imgarch }}; kubectl create -f csi/deploy/kubernetes; ignore_errors: "true" when: |