diff options
Diffstat (limited to 'plugins')
21 files changed, 365 insertions, 56 deletions
diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/files/opendaylight.service b/plugins/odl_sfc/roles/setup-odl-sfc/files/opendaylight.service index a6966d82..fe125ccf 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/files/opendaylight.service +++ b/plugins/odl_sfc/roles/setup-odl-sfc/files/opendaylight.service @@ -10,7 +10,7 @@ Type=simple WorkingDirectory=/opt/opendaylight PermissionsStartOnly=true ExecStartPre= -ExecStart=/usr/lib/jvm/java-8-oracle/bin/java -Djava.security.properties=/opt/opendaylight/etc/odl.java.security -server -Xms128M -Xmx2048m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Djava.security.egd=file:/dev/./urandom -Djava.endorsed.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/endorsed:/usr/lib/jvm/java-8-oracle/lib/endorsed:/opt/opendaylight/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/ext:/usr/lib/jvm/java-8-oracle/lib/ext:/opt/opendaylight/lib/ext -Dkaraf.instances=/opt/opendaylight/instances -Dkaraf.home=/opt/opendaylight -Dkaraf.base=/opt/opendaylight -Dkaraf.data=/opt/opendaylight/data -Dkaraf.etc=/opt/opendaylight/etc -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/opt/opendaylight/data/tmp -Djava.util.logging.config.file=/opt/opendaylight/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /opt/opendaylight/lib/boot/org.apache.karaf.diagnostic.boot-4.0.9.jar:/opt/opendaylight/lib/boot/org.apache.karaf.jaas.boot-4.0.9.jar:/opt/opendaylight/lib/boot/org.apache.karaf.main-4.0.9.jar:/opt/opendaylight/lib/boot/org.osgi.core-6.0.0.jar org.apache.karaf.main.Main +ExecStart=/usr/lib/jvm/java-8-oracle/bin/java -Djava.security.properties=/opt/opendaylight/etc/odl.java.security -server -Xms128M -Xmx2048m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Djava.security.egd=file:/dev/./urandom -Djava.endorsed.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/endorsed:/usr/lib/jvm/java-8-oracle/lib/endorsed:/opt/opendaylight/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/ext:/usr/lib/jvm/java-8-oracle/lib/ext:/opt/opendaylight/lib/ext -Dkaraf.instances=/opt/opendaylight/instances -Dkaraf.home=/opt/opendaylight -Dkaraf.base=/opt/opendaylight -Dkaraf.data=/opt/opendaylight/data -Dkaraf.etc=/opt/opendaylight/etc -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/opt/opendaylight/data/tmp -Djava.util.logging.config.file=/opt/opendaylight/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /opt/opendaylight/lib/boot/org.apache.karaf.diagnostic.boot-4.0.10.jar:/opt/opendaylight/lib/boot/org.apache.karaf.jaas.boot-4.0.10.jar:/opt/opendaylight/lib/boot/org.apache.karaf.main-4.0.10.jar:/opt/opendaylight/lib/boot/org.osgi.core-6.0.0.jar org.apache.karaf.main.Main Restart=on-failure LimitNOFILE=65535 TimeoutStopSec=15 diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/files/sfc.conf b/plugins/odl_sfc/roles/setup-odl-sfc/files/sfc.conf index acf2e2f4..6621a212 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/files/sfc.conf +++ b/plugins/odl_sfc/roles/setup-odl-sfc/files/sfc.conf @@ -1,6 +1,6 @@ [DEFAULT] -service_plugins = odl-router,metering,networking_sfc.services.sfc.plugin.SfcPlugin,networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin +service_plugins = odl-router_v2,metering,trunk,networking_sfc.services.sfc.plugin.SfcPlugin,networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin [sfc] drivers = odl diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-1.yml index 684f314c..13b4c571 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-1.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-1.yml @@ -8,7 +8,7 @@ - name: install networking-odl pip: name: networking-odl - virtualenv: /openstack/venvs/neutron-15.1.4 + virtualenv: /openstack/venvs/neutron-{{ os_ver }} - name: configure vsctl for dhcp agent shell: | diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-2.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-2.yml index 82a26005..39b501db 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-2.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-2.yml @@ -70,7 +70,7 @@ - name: Set host OVS configurations command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig \ + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-odl-ovs-hostconfig \ --datapath_type=system --bridge_mappings={{ contr_l2_mappings }} when: - inventory_hostname not in groups['nova_compute'] @@ -78,7 +78,7 @@ - name: Set host OVS configurations command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig \ + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-odl-ovs-hostconfig \ --datapath_type=system --bridge_mappings={{ contr_l3_mappings }} when: - inventory_hostname not in groups['nova_compute'] @@ -86,14 +86,14 @@ - name: Set host OVS configurations command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig --datapath_type=system + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-odl-ovs-hostconfig --datapath_type=system when: - inventory_hostname in groups['nova_compute'] - odl_l3_agent == "Disable" - name: Set host OVS configurations command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-odl-ovs-hostconfig --datapath_type=system --bridge_mappings={{ compu_l3_mappings }} when: - inventory_hostname in groups['nova_compute'] diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-repos-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-repos-1.yml index 7b699a35..0eacde6e 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-repos-1.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-repos-1.yml @@ -1,7 +1,7 @@ --- - name: copy download script - copy: - src: odl_pkg.sh + template: + src: odl_pkg.sh.j2 dest: /opt/odl_pkg.sh mode: 0777 diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-1.yml index 40149346..0269bb37 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-1.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-1.yml @@ -8,12 +8,12 @@ - name: install networking-odl pip: name: networking-odl - virtualenv: /openstack/venvs/neutron-15.1.4 # Todo: hardcode, need to modify + virtualenv: /openstack/venvs/neutron-{{ os_ver }} - name: install networking-sfc pip: name: networking-sfc - virtualenv: /openstack/venvs/neutron-15.1.4 + virtualenv: /openstack/venvs/neutron-{{ os_ver }} when: odl_sfc == "Enable" - name: turn off neutron-server on control node diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-2.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-2.yml index d8bcf154..be45567a 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-2.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-2.yml @@ -3,7 +3,7 @@ - name: configure odl l3 driver shell: | crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins \ - odl-router,metering; + odl-router_v2,metering,trunk; when: odl_l3_agent == "Enable" - name: configure opendaylight -> ml2 diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-3.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-3.yml index 0c11e36f..c4451ca2 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-3.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-3.yml @@ -2,7 +2,7 @@ - name: Perform a Neutron DB online upgrade command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade --expand @@ -11,7 +11,7 @@ - name: Perform a Neutron DB offline upgrade command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade --contract @@ -20,7 +20,7 @@ - name: SFC DB upgrade command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-db-manage --subproject networking-sfc upgrade head become: "yes" diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-tacker-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-tacker-1.yml index c43b6dcc..8fd1109f 100644 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-tacker-1.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-tacker-1.yml @@ -3,6 +3,5 @@ - name: upgrade networking-sfc pip: name: networking-sfc - extra_args: -U - virtualenv: /openstack/venvs/tacker-15.1.4 + virtualenv: /openstack/venvs/tacker-{{ os_ver }} when: odl_sfc == "Enable" diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/templates/odl_pkg.sh.j2 b/plugins/odl_sfc/roles/setup-odl-sfc/templates/odl_pkg.sh.j2 new file mode 100755 index 00000000..f8882b23 --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/templates/odl_pkg.sh.j2 @@ -0,0 +1,19 @@ +#!/bin/bash + +rm -rf /home/networking +rm -rf /home/tmp + +mkdir -p /home/networking +mkdir -p /home/tmp + +cd /home/networking + +git clone https://github.com/openstack/networking-odl.git -b stable/{{ os_name }} +git clone https://github.com/openstack/networking-sfc.git -b stable/{{ os_name }} + +pip wheel /home/networking/networking-odl/ -w /home/tmp/ +pip wheel /home/networking/networking-sfc/ -w /home/tmp/ + +cp /home/tmp/networking* /var/www/repo/os-releases/{{ os_ver }}/ubuntu-16.04-x86_64/ + +sleep 30 diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/templates/org.apache.karaf.features.cfg b/plugins/odl_sfc/roles/setup-odl-sfc/templates/org.apache.karaf.features.cfg index afb7e6b5..05f7a7cd 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/templates/org.apache.karaf.features.cfg +++ b/plugins/odl_sfc/roles/setup-odl-sfc/templates/org.apache.karaf.features.cfg @@ -37,9 +37,9 @@ # Comma separated list of features repositories to register by default # featuresRepositories = \ - mvn:org.opendaylight.integration/features-index/0.7.0/xml/features, \ - mvn:org.apache.karaf.features/framework/4.0.9/xml/features, \ - mvn:org.apache.karaf.features/standard/4.0.9/xml/features + mvn:org.opendaylight.integration/features-index/0.7.1/xml/features, \ + mvn:org.apache.karaf.features/framework/4.0.10/xml/features, \ + mvn:org.apache.karaf.features/standard/4.0.10/xml/features # # Comma separated list of features to install at startup diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml b/plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml index b3d71edb..014fc5b8 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml @@ -9,6 +9,9 @@ --- openstack_passwd_file: /etc/openstack_deploy/user_secrets.yml +os_ver: 16.0.5 +os_name: pike + odl_username: admin odl_password: admin odl_api_port: 8181 @@ -18,8 +21,8 @@ sfc_plugins: src: sfc.conf dst: /opt/sfc.conf -odl_pkg_url: karaf-0.7.0.tar.gz -odl_pkg_name: karaf-0.7.0.tar.gz +odl_pkg_url: karaf-0.7.1.tar.gz +odl_pkg_name: karaf-0.7.1.tar.gz odl_home: "/opt/opendaylight/" odl_base_features: - config @@ -49,19 +52,9 @@ odl_extra_features: odl_features: "{{ odl_base_features + odl_extra_features }}" -sdn_package: http://artifacts.opnfv.org/compass4nfv/packages/master/sdn_package.tar.gz - -# yamllint disable rule:line-length -networking_odl_url: https://launchpad.net/networking-odl/4.0-ocata/4.0.0/+download/networking-odl-4.0.0.tar.gz -# yamllint enable rule:line-length +sdn_package: http://artifacts.opnfv.org/compass4nfv/package/master/sdn_package.tar.gz jdk8_pkg_name: jdk-8u51-linux-x64.tar.gz jdk8_script_name: install_jdk8.tar common_packages_noarch: [] - -odl_pip: networking-odl-3.2.0 - -networking_odl_version: 4.0.0 - -networking_odl_pkg_name: networking-odl-3.2.0.tar.gz diff --git a/plugins/odl_sfc/roles/sfc-pre-2/files/odl_sfc.patch b/plugins/odl_sfc/roles/sfc-pre-2/files/odl_sfc.patch new file mode 100644 index 00000000..9e25214a --- /dev/null +++ b/plugins/odl_sfc/roles/sfc-pre-2/files/odl_sfc.patch @@ -0,0 +1,90 @@ +diff --git a/defaults/main.yml b/defaults/main.yml +index fd6fc37..3ae4bce 100644 +--- a/defaults/main.yml ++++ b/defaults/main.yml +@@ -381,3 +381,9 @@ dragonflow_ex_peer_patch_port: patch-int + dragonflow_int_peer_patch_port: patch-ex + dragonflow_external_network_bridge: br-ex + dragonflow_publisher_bind_address: "*" ++ ++# Install Openvswitch without NSH support ++ovs_nsh_support: True ++# ++# # Set higher priority to mardim PPA when ovs_nsh_support is True ++ovs_nsh_apt_pinned_packages: [{ package: "*", release: "LP-PPA-mardim-mardim-ppa"}] +diff --git a/meta/main.yml b/meta/main.yml +index 418b4a9..7a6739a 100644 +--- a/meta/main.yml ++++ b/meta/main.yml +@@ -39,7 +39,10 @@ galaxy_info: + - openstack + dependencies: + - pip_install +- - apt_package_pinning ++ - role: apt_package_pinning ++ apt_pinned_packages: "{{ ovs_nsh_support | ternary(ovs_nsh_apt_pinned_packages, omit) }}" ++ when: ++ - ansible_pkg_mgr == 'apt' + - galera_client + - openstack_openrc + - role: etcd +diff --git a/tasks/neutron_pre_install.yml b/tasks/neutron_pre_install.yml +index 59fd87f..1162a2b 100644 +--- a/tasks/neutron_pre_install.yml ++++ b/tasks/neutron_pre_install.yml +@@ -79,3 +79,12 @@ + mode: "0440" + owner: "root" + group: "root" ++ ++- name: add ovs-nsh repo ++ apt_repository: ++ repo: "ppa:mardim/mardim-ppa" ++ update_cache: True ++ state: present ++ when: ++ - ansible_pkg_mgr == 'apt' ++ - ovs_nsh_support | bool +diff --git a/vars/main.yml b/vars/main.yml +index dec0e36..afdff3f 100644 +--- a/vars/main.yml ++++ b/vars/main.yml +@@ -27,8 +27,12 @@ neutron_package_list: |- + {% if (neutron_services['neutron-openvswitch-agent']['group'] in group_names and neutron_services['neutron-openvswitch-agent'].service_en | bool) + or (neutron_services['dragonflow-controller-agent']['group'] in group_names and neutron_services['dragonflow-controller-agent'].service_en | bool) + or (neutron_services['dragonflow-l3-agent']['group'] in group_names and neutron_services['dragonflow-l3-agent'].service_en | bool) %} ++ {% if (ovs_nsh_support and ansible_pkg_mgr in ['apt', 'zypper']) %} ++ {% set _ = packages.extend(neutron_ovs_nsh_required_packages) %} ++ {% else %} + {% set _ = packages.extend(neutron_ovs_distro_packages) %} + {% endif %} ++ {% endif %} + {% if neutron_services['neutron-linuxbridge-agent']['group'] in group_names and neutron_services['neutron-linuxbridge-agent'].service_en | bool %} + {% set _ = packages.extend(neutron_lxb_distro_packages) %} + {% endif %} +@@ -50,6 +54,8 @@ calico_felix_bin: /usr/local/bin/calico-felix + ### Python code details + ### + ++neutron_ovs_nsh_distro_packages: [] ++ + neutron_requires_pip_packages: + - virtualenv + - virtualenv-tools +diff --git a/vars/ubuntu-16.04.yml b/vars/ubuntu-16.04.yml +index eb52ebf..a2c6275 100644 +--- a/vars/ubuntu-16.04.yml ++++ b/vars/ubuntu-16.04.yml +@@ -25,6 +25,12 @@ neutron_vpnaas_service_provider: VPN:strongswan:neutron_vpnaas.services.vpn.serv + ## APT Cache options + cache_timeout: 600 + ++neutron_ovs_nsh_required_packages: ++ - openvswitch-datapath-dkms ++ - openvswitch-common ++ - openvswitch-switch ++ - python-openvswitch ++ + neutron_distro_packages: + - conntrack + - dnsmasq-base diff --git a/plugins/odl_sfc/roles/sfc-pre-2/tasks/setup_sfc.yml b/plugins/odl_sfc/roles/sfc-pre-2/tasks/setup_sfc.yml index a80a81ef..039d5460 100644 --- a/plugins/odl_sfc/roles/sfc-pre-2/tasks/setup_sfc.yml +++ b/plugins/odl_sfc/roles/sfc-pre-2/tasks/setup_sfc.yml @@ -7,28 +7,14 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## --- -- name: add ovs package in neutron - lineinfile: - dest: /etc/ansible/roles/os_neutron/vars/ubuntu-16.04.yml - insertbefore: 'openvswitch-common' - line: ' - openvswitch-datapath-dkms' -- name: add ovs package in neutron - lineinfile: - dest: /etc/ansible/roles/os_neutron/vars/ubuntu-16.04.yml - insertafter: 'openvswitch-switch' - line: ' - python-openvswitch' +- name: copy patch file + copy: + src: odl_sfc.patch + dest: /opt/odl_sfc.patch -- name: modify ovs installation in neutron - blockinfile: - dest: /etc/ansible/roles/os_neutron/tasks/neutron_install.yml - insertafter: '^# limitations' - block: | - - name: add ovs-nsh repo - apt_repository: - repo: "ppa:mardim/mardim-ppa" - update_cache: True - state: present - when: - - inventory_hostname in groups['neutron_openvswitch_agent'] - - inventory_hostname not in groups['nova_compute'] +- name: apply odl_sfc patch to os_neutron + shell: | + cd /etc/ansible/roles/os_neutron; + patch -p1 < /opt/odl_sfc.patch; + cd - 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 %} |