diff options
author | chenshuai@huawei.com <chenshuai@huawei.com> | 2015-08-10 04:52:34 -0400 |
---|---|---|
committer | chenshuai@huawei.com <chenshuai@huawei.com> | 2015-08-21 22:21:35 -0400 |
commit | 0597d98b2169ec834bcdb18ea6e11ba59120e529 (patch) | |
tree | d935a0839ff821ec60e242025e717160de73c81a /deploy/adapters/ansible/roles/odl_cluster/templates | |
parent | fa0b0bebe9130e71f9b41659a233b61406eab884 (diff) |
Write ansible script for ODL Cluster
JIRA: COMPASS-12
Change-Id: I8d795124262564c99da4f738235d9af0221503fe
Signed-off-by: chenshuai@huawei.com <chenshuai@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible/roles/odl_cluster/templates')
10 files changed, 389 insertions, 0 deletions
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 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="framework-3.0.1"> + <repository>mvn:org.jolokia/jolokia-osgi/1.1.5/xml/features</repository> + <feature name="jolokia-osgi" version="1.1.5" description="Jolokia Agent"> + <bundle start-level="5" start="true">mvn:org.jolokia/jolokia-osgi/1.1.5</bundle> + </feature> +</features> + 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 Binary files differnew file mode 100644 index 00000000..18e8710b --- /dev/null +++ b/deploy/adapters/ansible/roles/odl_cluster/templates/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar 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 <<EOT>> /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 = "<friendly_name_of_the_module>" +# shards = [ +# { +# name="<any_name_that_is_unique_for_the_module>" +# replicas = [ +# "<name_of_member_on_which_to_run>" +# ] +# ] +# } +# +# 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 @@ +<?xml version='1.0' encoding='utf-8'?> +<!-- + 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. +--> +<Server> + <!--APR library loader. Documentation at /docs/apr.html --> + <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> + <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html --> + <Listener className="org.apache.catalina.core.JasperListener" /> + <!-- Prevent memory leaks due to use of particular java/javax APIs--> + <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> + <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> + <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> + + <Service name="Catalina"> + <Connector port="{{ odl_api_port }}" protocol="HTTP/1.1" + connectionTimeout="20000" + redirectPort="8443" /> + +<!-- + Please remove the comments around the following Connector tag to enable HTTPS Authentication support. + Remember to add a valid keystore in the configuration folder. + More info : http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration +--> + + <!-- + <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" + maxThreads="150" scheme="https" secure="true" + clientAuth="false" sslProtocol="TLS" + keystoreFile="configuration/keystore" + keystorePass="changeit"/> + --> + + <Engine name="Catalina" defaultHost="localhost"> + <Host name="localhost" appBase="" + unpackWARs="false" autoDeploy="false" + deployOnStartup="false" createDirs="false"> + <Realm className="org.opendaylight.controller.karafsecurity.ControllerCustomRealm" /> + <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> + <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" + prefix="web_access_log_" suffix=".txt" resolveHosts="false" + rotatable="true" fileDateFormat="yyyy-MM" + pattern="%{yyyy-MM-dd HH:mm:ss.SSS z}t - [%a] - %r"/> + </Host> + </Engine> + </Service> +</Server> + |