From 0597d98b2169ec834bcdb18ea6e11ba59120e529 Mon Sep 17 00:00:00 2001 From: "chenshuai@huawei.com" Date: Mon, 10 Aug 2015 04:52:34 -0400 Subject: Write ansible script for ODL Cluster JIRA: COMPASS-12 Change-Id: I8d795124262564c99da4f738235d9af0221503fe Signed-off-by: chenshuai@huawei.com --- .../ansible/roles/odl_cluster/templates/akka.conf | 105 +++++++++++++++++++++ .../1.1.5/jolokia-osgi-1.1.5-features.xml | 8 ++ .../jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar | Bin 0 -> 312258 bytes .../jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar.sha1 | 1 + .../roles/odl_cluster/templates/ml2_conf.sh | 6 ++ .../roles/odl_cluster/templates/module-shards.conf | 101 ++++++++++++++++++++ .../roles/odl_cluster/templates/opendaylight.conf | 40 ++++++++ .../odl_cluster/templates/opendaylight.service | 13 +++ .../templates/org.apache.karaf.features.cfg | 54 +++++++++++ .../roles/odl_cluster/templates/tomcat-server.xml | 61 ++++++++++++ 10 files changed, 389 insertions(+) create mode 100644 deploy/adapters/ansible/roles/odl_cluster/templates/akka.conf create mode 100644 deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5-features.xml create mode 100644 deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar create mode 100644 deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar.sha1 create mode 100644 deploy/adapters/ansible/roles/odl_cluster/templates/ml2_conf.sh create mode 100644 deploy/adapters/ansible/roles/odl_cluster/templates/module-shards.conf create mode 100644 deploy/adapters/ansible/roles/odl_cluster/templates/opendaylight.conf create mode 100644 deploy/adapters/ansible/roles/odl_cluster/templates/opendaylight.service create mode 100644 deploy/adapters/ansible/roles/odl_cluster/templates/org.apache.karaf.features.cfg create mode 100644 deploy/adapters/ansible/roles/odl_cluster/templates/tomcat-server.xml (limited to 'deploy/adapters/ansible/roles/odl_cluster/templates') diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/akka.conf b/deploy/adapters/ansible/roles/odl_cluster/templates/akka.conf new file mode 100644 index 00000000..4818e340 --- /dev/null +++ b/deploy/adapters/ansible/roles/odl_cluster/templates/akka.conf @@ -0,0 +1,105 @@ + +odl-cluster-data { + bounded-mailbox { + mailbox-type = "org.opendaylight.controller.cluster.common.actor.MeteredBoundedMailbox" + mailbox-capacity = 1000 + mailbox-push-timeout-time = 100ms + } + + metric-capture-enabled = true + + akka { + loglevel = "INFO" + loggers = ["akka.event.slf4j.Slf4jLogger"] + + actor { + + provider = "akka.cluster.ClusterActorRefProvider" + serializers { + java = "akka.serialization.JavaSerializer" + proto = "akka.remote.serialization.ProtobufSerializer" + } + + serialization-bindings { + "com.google.protobuf.Message" = proto + + } + } + remote { + log-remote-lifecycle-events = off + netty.tcp { + hostname = "{{ hostvars[inventory_hostname]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}" + port = 2550 + maximum-frame-size = 419430400 + send-buffer-size = 52428800 + receive-buffer-size = 52428800 + } + } + + cluster { + seed-nodes = [ +{% for host in groups['odl_controller'] %} + {% if loop.last %} + "akka.tcp://opendaylight-cluster-data@{{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:2550" + {% else %} + "akka.tcp://opendaylight-cluster-data@{{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:2550", + {% endif %} +{% endfor %} + ] + + auto-down-unreachable-after = 10s + + roles = [ +{% set key = 0 %} +{% for host in groups['odl_controller'] %} + {% set key = key + 1 %} + {% if hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address == hostvars[inventory_hostname]['ansible_' + INTERNAL_INTERFACE].ipv4.address %} + "member-{{ key }}" + {% endif %} +{% endfor %} + ] + + } + } +} + +odl-cluster-rpc { + bounded-mailbox { + mailbox-type = "org.opendaylight.controller.cluster.common.actor.MeteredBoundedMailbox" + mailbox-capacity = 1000 + mailbox-push-timeout-time = 100ms + } + + metric-capture-enabled = true + + akka { + loglevel = "INFO" + loggers = ["akka.event.slf4j.Slf4jLogger"] + + actor { + provider = "akka.cluster.ClusterActorRefProvider" + + } + remote { + log-remote-lifecycle-events = off + netty.tcp { + hostname = "{{ hostvars[inventory_hostname]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}" + port = 2551 + } + } + + cluster { + seed-nodes = [ +{% for host in groups['odl_controller'] %} + {% if loop.last %} + "akka.tcp://odl-cluster-rpc@{{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:2551" + {% else %} + "akka.tcp://odl-cluster-rpc@{{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:2551", + {% endif %} +{% endfor %} + ] + + auto-down-unreachable-after = 10s + } + } +} diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5-features.xml b/deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5-features.xml new file mode 100644 index 00000000..6242d788 --- /dev/null +++ b/deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5-features.xml @@ -0,0 +1,8 @@ + + + mvn:org.jolokia/jolokia-osgi/1.1.5/xml/features + + mvn:org.jolokia/jolokia-osgi/1.1.5 + + + diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar b/deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar new file mode 100644 index 00000000..18e8710b Binary files /dev/null and b/deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar differ diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar.sha1 b/deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar.sha1 new file mode 100644 index 00000000..790e6ef2 --- /dev/null +++ b/deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar.sha1 @@ -0,0 +1 @@ +ba513164178626519a6fb12ced4a3d6e1e07dd54 \ No newline at end of file diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/ml2_conf.sh b/deploy/adapters/ansible/roles/odl_cluster/templates/ml2_conf.sh new file mode 100644 index 00000000..1ce1e41e --- /dev/null +++ b/deploy/adapters/ansible/roles/odl_cluster/templates/ml2_conf.sh @@ -0,0 +1,6 @@ +cat <> /etc/neutron/plugins/ml2/ml2_conf.ini +[ml2_odl] +password = admin +username = admin +url = http://{{ hostvars[inventory_hostname]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:8080/controller/nb/v2/neutron +EOT diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/module-shards.conf b/deploy/adapters/ansible/roles/odl_cluster/templates/module-shards.conf new file mode 100644 index 00000000..4477b392 --- /dev/null +++ b/deploy/adapters/ansible/roles/odl_cluster/templates/module-shards.conf @@ -0,0 +1,101 @@ +# This file describes which shards live on which members +# The format for a module-shards is as follows, +# { +# name = "" +# shards = [ +# { +# name="" +# replicas = [ +# "" +# ] +# ] +# } +# +# For Helium we support only one shard per module. Beyond Helium +# we will support more than 1 +# The replicas section is a collection of member names. This information +# will be used to decide on which members replicas of a particular shard will be +# located. Once replication is integrated with the distributed data store then +# this section can have multiple entries. +# +# + + +module-shards = [ + { + name = "default" + shards = [ + { + name="default" + replicas = [ +{% set key = 0 %} +{% for host in groups['controller'] %} + {% set key = key + 1 %} + {% if loop.last %} + "member-{{ key }}" + {% else %} + "member-{{ key }}", + {% endif %} +{% endfor %} + ] + } + ] + }, + { + name = "topology" + shards = [ + { + name="topology" + replicas = [ +{% set key = 0 %} +{% for host in groups['controller'] %} + {% set key = key + 1 %} + {% if loop.last %} + "member-{{ key }}" + {% else %} + "member-{{ key }}", + {% endif %} +{% endfor %} + ] + } + ] + }, + { + name = "inventory" + shards = [ + { + name="inventory" + replicas = [ +{% set key = 0 %} +{% for host in groups['controller'] %} + {% set key = key + 1 %} + {% if loop.last %} + "member-{{ key }}" + {% else %} + "member-{{ key }}", + {% endif %} +{% endfor %} + ] + } + ] + }, + { + name = "toaster" + shards = [ + { + name="toaster" + replicas = [ +{% set key = 0 %} +{% for host in groups['controller'] %} + {% set key = key + 1 %} + {% if loop.last %} + "member-{{ key }}" + {% else %} + "member-{{ key }}", + {% endif %} +{% endfor %} + ] + } + ] + } +] diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/opendaylight.conf b/deploy/adapters/ansible/roles/odl_cluster/templates/opendaylight.conf new file mode 100644 index 00000000..c9a36f2e --- /dev/null +++ b/deploy/adapters/ansible/roles/odl_cluster/templates/opendaylight.conf @@ -0,0 +1,40 @@ + +# vim:set ft=upstart ts=2 et: +description "OpenDaylight controller" +author "mskalski@miranits.com" + +start on runlevel [2345] +stop on runlevel [!2345] + +setgid odl +setuid odl + +env KARAF_HOME="/opt/opendaylight-0.3.0" +env JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64" +env JAVA_OPTS="-server -Xms128M -Xmx4096M -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:MaxPermSize=512M -Dcom.sun.management.jmxremote" +env OPTS="-Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true" +env MAIN="org.apache.karaf.main.Main" + + +chdir /opt/opendaylight-0.3.0 + +script + export KARAF_BASE="$KARAF_HOME" + export KARAF_DATA="$KARAF_BASE/data" + export KARAF_ETC="$KARAF_BASE/etc" + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:$KARAF_BASE/lib" + export JAVA_ENDORSED_DIRS="${JAVA_HOME}/jre/lib/endorsed:${JAVA_HOME}/lib/endorsed:${KARAF_HOME}/lib/endorsed" + export JAVA_EXT_DIRS="${JAVA_HOME}/jre/lib/ext:${JAVA_HOME}/lib/ext:${KARAF_HOME}/lib/ext" + + for file in "$KARAF_HOME"/lib/karaf*.jar + do + if [ -z "$CLASSPATH" ]; then + CLASSPATH="$file" + else + CLASSPATH="$CLASSPATH:$file" + fi + done + + exec /usr/bin/java $JAVA_OPTS -Djava.endorsed.dirs="${JAVA_ENDORSED_DIRS}" -Djava.ext.dirs="${JAVA_EXT_DIRS}" -Dkaraf.instances="${KARAF_HOME}/instances" -Dkaraf.home="$KARAF_HOME" -Dkaraf.base="$KARAF_BASE" -Dkaraf.data="$KARAF_DATA" -Dkaraf.etc="$KARAF_ETC" -Djava.io.tmpdir="$KARAF_DATA/tmp" -Djava.util.logging.config.file="$KARAF_BASE/etc/java.util.logging.properties" $KARAF_OPTS $OPTS -classpath "$CLASSPATH" $MAIN + +end script diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/opendaylight.service b/deploy/adapters/ansible/roles/odl_cluster/templates/opendaylight.service new file mode 100644 index 00000000..61a1dbdc --- /dev/null +++ b/deploy/adapters/ansible/roles/odl_cluster/templates/opendaylight.service @@ -0,0 +1,13 @@ +[Unit] +Description=OpenDaylight SDN Controller +Documentation=https://wiki.opendaylight.org/view/Main_Page http://www.opendaylight.org/ +After=network.service + +[Service] +Type=forking +ExecStart=/opt/opendaylight-0.2.2/bin/start +User=odl +Group=odl + +[Install] +WantedBy=multi-user.target diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/org.apache.karaf.features.cfg b/deploy/adapters/ansible/roles/odl_cluster/templates/org.apache.karaf.features.cfg new file mode 100644 index 00000000..e53a07b2 --- /dev/null +++ b/deploy/adapters/ansible/roles/odl_cluster/templates/org.apache.karaf.features.cfg @@ -0,0 +1,54 @@ +################################################################################ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +# +# Defines if the startlvl should be respected during feature startup. The default value is true. The default +# behavior for 2.x is false (!) for this property +# +# Be aware that this property is deprecated and will be removed in Karaf 4.0. So, if you need to +# set this to false, please use this only as a temporary solution! +# +#respectStartLvlDuringFeatureStartup=true + + +# +# Defines if the startlvl should be respected during feature uninstall. The default value is true. +# If true, means stop bundles respecting the descend order of start level in a certain feature. +# +#respectStartLvlDuringFeatureUninstall=true + +# +# Comma separated list of features repositories to register by default +# +#featuresRepositories = mvn:org.apache.karaf.features/standard/3.0.1/xml/features,mvn:org.apache.karaf.features/enterprise/3.0.1/xml/features,mvn:org.ops4j.pax.web/pax-web-features/3.1.0/xml/features,mvn:org.apache.karaf.features/spring/3.0.1/xml/features,mvn:org.opendaylight.integration/features-integration/0.2.2-Helium-SR2/xml/features,mvn:org.jolokia/jolokia-osgi/1.1.4/xml/features + +featuresRepositories = mvn:org.apache.karaf.features/standard/3.0.1/xml/features,mvn:org.apache.karaf.features/enterprise/3.0.1/xml/features,mvn:org.ops4j.pax.web/pax-web-features/3.1.0/xml/features,mvn:org.apache.karaf.features/spring/3.0.1/xml/features,mvn:org.opendaylight.integration/features-integration/0.2.2-Helium-SR2/xml/features,mvn:org.jolokia/jolokia-osgi/1.1.4/xml/features + +# +# Comma separated list of features to install at startup +# Default features: +# config,standard,region,package,kar,ssh,management +# +featuresBoot= {{ odl_features | join(",") }} + +# +# Defines if the boot features are started in asynchronous mode (in a dedicated thread) +# +featuresBootAsynchronous=false + diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/tomcat-server.xml b/deploy/adapters/ansible/roles/odl_cluster/templates/tomcat-server.xml new file mode 100644 index 00000000..bc7ab13d --- /dev/null +++ b/deploy/adapters/ansible/roles/odl_cluster/templates/tomcat-server.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit 1.2.3-korg