diff options
Diffstat (limited to 'deploy/adapters/ansible')
15 files changed, 138 insertions, 86 deletions
diff --git a/deploy/adapters/ansible/roles/aodh/handlers/main.yml b/deploy/adapters/ansible/roles/aodh/handlers/main.yml index 4ff2a4f9..983de9fc 100644 --- a/deploy/adapters/ansible/roles/aodh/handlers/main.yml +++ b/deploy/adapters/ansible/roles/aodh/handlers/main.yml @@ -10,3 +10,11 @@ - name: restart aodh services service: name={{ item }} state=restarted enabled=yes with_items: "{{ services | union(services_noarch) }}" + +- name: aodh reload apache + service: name={{ item }} state=reloaded + with_items: "{{ http_service_name }}" + +- name: aodh restart apache + service: name={{ item }} state=restarted enabled=yes + with_items: "{{ http_service_name }}" diff --git a/deploy/adapters/ansible/roles/aodh/tasks/aodh_install.yml b/deploy/adapters/ansible/roles/aodh/tasks/aodh_install.yml index 4b86f7fd..4e2e8655 100644 --- a/deploy/adapters/ansible/roles/aodh/tasks/aodh_install.yml +++ b/deploy/adapters/ansible/roles/aodh/tasks/aodh_install.yml @@ -21,8 +21,51 @@ - restart aodh services - name: write services to monitor list - lineinfile: dest=/opt/service create=yes line='{{ item }}' + lineinfile: dest=/opt/service create=yes line={{ item }} with_items: "{{ services | union(services_noarch) }}" - name: remove default sqlite db shell: rm /var/lib/aodh/aodh.sqlite || touch aodh.sqllite.db.removed + +- name: disable aodh-api service + service: name={{ item }} state=stopped enabled=no + with_items: "{{ api_service }}" + +- name: add listen port + lineinfile: + dest: '{{ apache_config_dir }}/ports.conf' + regexp: "^Listen {{ internal_ip }}:8042" + line: "Listen {{ internal_ip }}:8042" + notify: aodh restart apache + +- name: create WSGIScriptAlias Path + file: + path: /var/www/cgi-bin/aodh + state: directory + mode: 0755 + +- name: copy WSGIScriptAlias file + shell: | + cp {{WSGIScriptAlias_file}} /var/www/cgi-bin/aodh/app; + +- name: update apache2 configs + template: + src: wsgi-aodh.conf.j2 + dest: '{{ apache_config_dir }}/sites-available/aodh.conf' + when: ansible_os_family == 'Debian' + notify: aodh reload apache + +- name: enable aodh server + file: + src: "{{ apache_config_dir }}/sites-available/aodh.conf" + dest: "{{ apache_config_dir }}/sites-enabled/aodh.conf" + state: "link" + when: ansible_os_family == 'Debian' + notify: aodh reload apache + +- name: update apache2 configs + template: + src: wsgi-aodh.conf.j2 + dest: '{{ apache_config_dir }}/aodh.conf' + when: ansible_os_family == 'RedHat' + notify: aodh reload apache diff --git a/deploy/adapters/ansible/roles/aodh/templates/wsgi-aodh.conf.j2 b/deploy/adapters/ansible/roles/aodh/templates/wsgi-aodh.conf.j2 new file mode 100644 index 00000000..8d71075e --- /dev/null +++ b/deploy/adapters/ansible/roles/aodh/templates/wsgi-aodh.conf.j2 @@ -0,0 +1,28 @@ +{% set work_threads = (ansible_processor_vcpus + 1) // 2 %} +{% if work_threads > 10 %} +{% set work_threads = 10 %} +{% endif %} + +<VirtualHost {{ internal_ip }}:8042> + WSGIDaemonProcess aodh-api processes=4 threads={{ work_threads }} user=aodh group=aodh display-name=%{GROUP} + WSGIProcessGroup aodh-api + WSGIScriptAlias / /var/www/cgi-bin/aodh/app + WSGIApplicationGroup %{GLOBAL} + <IfVersion >= 2.4> + ErrorLogFormat "%{cu}t %M" + </IfVersion> + ErrorLog /var/log/{{ http_service_name }}/aodh.log + CustomLog /var/log/{{ http_service_name }}/aodh_access.log combined + + <Directory /usr/lib/python2.7/dist-packages/aodh/api/> + <IfVersion >= 2.4> + Require all granted + </IfVersion> + <IfVersion < 2.4> + Order allow,deny + Allow from all + </IfVersion> + </Directory> +</VirtualHost> + +WSGISocketPrefix /var/run/{{ http_service_name }} diff --git a/deploy/adapters/ansible/roles/aodh/vars/Debian.yml b/deploy/adapters/ansible/roles/aodh/vars/Debian.yml index 9bf4ad7a..edf73641 100644 --- a/deploy/adapters/ansible/roles/aodh/vars/Debian.yml +++ b/deploy/adapters/ansible/roles/aodh/vars/Debian.yml @@ -16,7 +16,12 @@ packages: - python-aodhclient services: - - aodh-api - aodh-notifier - aodh-evaluator - aodh-listener + +api_service: aodh-api + +apache_config_dir: /etc/apache2 +http_service_name: apache2 +WSGIScriptAlias_file: /usr/lib/python2.7/dist-packages/aodh/api/app.wsgi diff --git a/deploy/adapters/ansible/roles/aodh/vars/RedHat.yml b/deploy/adapters/ansible/roles/aodh/vars/RedHat.yml index 3d25bd6c..dba345fb 100644 --- a/deploy/adapters/ansible/roles/aodh/vars/RedHat.yml +++ b/deploy/adapters/ansible/roles/aodh/vars/RedHat.yml @@ -16,7 +16,12 @@ packages: - python-aodhclient services: - - openstack-aodh-api - openstack-aodh-notifier - openstack-aodh-evaluator - openstack-aodh-listener + +api_service: openstack-aodh-api + +apache_config_dir: /etc/httpd/conf.d +http_service_name: httpd +WSGIScriptAlias_file: /usr/lib/python2.7/site-packages/aodh/api/app.wsgi diff --git a/deploy/adapters/ansible/roles/ext-network/vars/Debian.yml b/deploy/adapters/ansible/roles/ext-network/vars/Debian.yml index 8cebcb48..069afc14 100644 --- a/deploy/adapters/ansible/roles/ext-network/vars/Debian.yml +++ b/deploy/adapters/ansible/roles/ext-network/vars/Debian.yml @@ -10,8 +10,6 @@ api_services: - nova-api - glance-api - - ceilometer-api - heat-api - heat-api-cfn - - aodh-api - cinder-api diff --git a/deploy/adapters/ansible/roles/ext-network/vars/RedHat.yml b/deploy/adapters/ansible/roles/ext-network/vars/RedHat.yml index f595d7ba..47fc4a32 100644 --- a/deploy/adapters/ansible/roles/ext-network/vars/RedHat.yml +++ b/deploy/adapters/ansible/roles/ext-network/vars/RedHat.yml @@ -10,7 +10,6 @@ api_services: - openstack-nova-api - openstack-glance-api - - openstack-ceilometer-api - openstack-heat-api - openstack-heat-api-cfn - openstack-cinder-api diff --git a/deploy/adapters/ansible/roles/odl_cluster/files/opendaylight.service b/deploy/adapters/ansible/roles/odl_cluster/files/opendaylight.service index 8773ee3c..c2cf84ff 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/files/opendaylight.service +++ b/deploy/adapters/ansible/roles/odl_cluster/files/opendaylight.service @@ -7,10 +7,10 @@ After= User=root Group=root Type=simple -WorkingDirectory=/opt/opendaylight-0.5.0 +WorkingDirectory=/opt/opendaylight PermissionsStartOnly=true ExecStartPre= -ExecStart=/usr/lib/jvm/java-8-oracle/bin/java -Djava.security.properties=/opt/opendaylight-0.5.0/etc/odl.java.security -server -Xms128M -Xmx2048m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Djava.endorsed.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/endorsed:/usr/lib/jvm/java-8-oracle/lib/endorsed:/opt/opendaylight-0.5.0/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/ext:/usr/lib/jvm/java-8-oracle/lib/ext:/opt/opendaylight-0.5.0/lib/ext -Dkaraf.instances=/opt/opendaylight-0.5.0/instances -Dkaraf.home=/opt/opendaylight-0.5.0 -Dkaraf.base=/opt/opendaylight-0.5.0 -Dkaraf.data=/opt/opendaylight-0.5.0/data -Dkaraf.etc=/opt/opendaylight-0.5.0/etc -Djava.io.tmpdir=/opt/opendaylight-0.5.0/data/tmp -Djava.util.logging.config.file=/opt/opendaylight-0.5.0/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /opt/opendaylight-0.5.0/lib/karaf.branding-1.7.0-Boron.jar:/opt/opendaylight-0.5.0/lib/karaf-jaas-boot.jar:/opt/opendaylight-0.5.0/lib/karaf.jar:/opt/opendaylight-0.5.0/lib/karaf-org.osgi.core.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 -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/karaf.branding-1.7.2-Boron-SR2.jar:/opt/opendaylight/lib/karaf-jaas-boot.jar:/opt/opendaylight/lib/karaf.jar:/opt/opendaylight/lib/karaf-org.osgi.core.jar org.apache.karaf.main.Main Restart=on-failure LimitNOFILE=65535 TimeoutStopSec=15 diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_03_copy_odl_configuration_files.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_03_copy_odl_configuration_files.yml index f4e87955..41aca7ee 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_03_copy_odl_configuration_files.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_03_copy_odl_configuration_files.yml @@ -40,6 +40,15 @@ mode: 0775 when: ansible_os_family == "RedHat" +- name: copy acl configuration script + template: + src: acl_conf.sh + dest: "/opt/acl_conf.sh" + mode: 0777 + +- name: execute acl configuration script + command: su -s /bin/sh -c "/opt/acl_conf.sh;" + - name: create tomcat config template: src: tomcat-server.xml diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_08_configure_neutron.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_08_configure_neutron.yml index 12c1fd25..5135c8cf 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_08_configure_neutron.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_08_configure_neutron.yml @@ -32,6 +32,24 @@ enable_isolated_metadata "True"; when: odl_l3_agent == "Enable" +- name: force metadata for l3 configuration + shell: | + crudini --set /etc/neutron/dhcp_agent.ini DEFAULT \ + force_metadata "True"; + when: odl_l3_agent == "Enable" + +- name: stop neutron l3 agent + service: name=neutron-l3-agent state=stopped enabled=no + when: odl_l3_agent == "Enable" and inventory_hostname in groups['odl'] + +- name: remove neutron l3 agent + shell: > + sed -i '/neutron-l3-agent/d' /opt/service; + rm -rf /lib/systemd/system/neutron-l3-agent.service; + rm -rf /etc/init/neutron-l3-agent.conf; + rm -rf /etc/init.d/neutron-l3-agent; + when: odl_l3_agent == "Enable" and inventory_hostname in groups['odl'] + - name: drop and recreate neutron database shell: | mysql -e "drop database if exists neutron;"; diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/acl_conf.sh b/deploy/adapters/ansible/roles/odl_cluster/templates/acl_conf.sh new file mode 100755 index 00000000..d05f33e5 --- /dev/null +++ b/deploy/adapters/ansible/roles/odl_cluster/templates/acl_conf.sh @@ -0,0 +1,12 @@ +############################################################################## +# 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 +############################################################################## +mkdir -p {{ odl_home }}etc/opendaylight/datastore/initial/config/ +CONFFILE=$(find {{ odl_home }} -name "*aclservice*config.xml") +cp $CONFFILE {{ odl_home }}etc/opendaylight/datastore/initial/config/netvirt-aclservice-config.xml +sed -i s/stateful/transparent/ {{ odl_home }}etc/opendaylight/datastore/initial/config/netvirt-aclservice-config.xml diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/opendaylight b/deploy/adapters/ansible/roles/odl_cluster/templates/opendaylight deleted file mode 100755 index 90a267d6..00000000 --- a/deploy/adapters/ansible/roles/odl_cluster/templates/opendaylight +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# chkconfig: 345 98 2 -# description: ODL controller -# OpenDaylight service controller script -export JAVA_HOME=/usr/lib/jvm/java-8-oracle -USER=odl - -cd /opt/opendaylight-0.3.0 -case "$1" in - start) - /bin/su -m $USER -s /bin/bash -c ./bin/start - ;; - stop) - /bin/su -m $USER -s /bin/bash -c ./bin/stop - ;; - status) - PID=`ps aux | grep java | grep karaf | awk '{print $2}'` - if test -z $PID - then - echo "ODL is down..." - exit 1 - else - echo "ODL is running... PID $PID" - exit 0 - fi - ;; - *) - echo "Usage: $0 {start|stop|status}" - exit 1 - ;; -esac diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/opendaylight.conf b/deploy/adapters/ansible/roles/odl_cluster/templates/opendaylight.conf deleted file mode 100755 index 105bb265..00000000 --- a/deploy/adapters/ansible/roles/odl_cluster/templates/opendaylight.conf +++ /dev/null @@ -1,42 +0,0 @@ - -# 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_HOME="/usr/lib/jvm/java-8-oracle" -env JAVA_OPTS="-server -Xms128M -Xmx4096M -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:MaxPermSize=512M -Dcom.sun.management.jmxremote" -env OPTS="-Dkaraf.startLocalConsole=true -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" - export JAVA_SECURITY_PRO="${KARAF_HOME}/etc/odl.java.security" - - for file in "$KARAF_HOME"/lib/karaf*.jar - do - if [ -z "$CLASSPATH" ]; then - CLASSPATH="$file" - else - CLASSPATH="$CLASSPATH:$file" - fi - done - - exec $JAVA_HOME/bin/java -Djava.security.properties="${JAVA_SECURITY_PRO}" $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/org.apache.karaf.features.cfg.Debian b/deploy/adapters/ansible/roles/odl_cluster/templates/org.apache.karaf.features.cfg.Debian index f3f6ad54..eebd47a6 100755 --- a/deploy/adapters/ansible/roles/odl_cluster/templates/org.apache.karaf.features.cfg.Debian +++ b/deploy/adapters/ansible/roles/odl_cluster/templates/org.apache.karaf.features.cfg.Debian @@ -36,12 +36,12 @@ # # Comma separated list of features repositories to register by default # -featuresRepositories = mvn:org.apache.karaf.features/standard/3.0.7/xml/features,mvn:org.apache.karaf.features/enterprise/3.0.7/xml/features,mvn:org.ops4j.pax.web/pax-web-features/3.2.9/xml/features,mvn:org.apache.karaf.features/spring/3.0.7/xml/features,mvn:org.opendaylight.integration/features-integration-index/0.5.0-Boron/xml/features +featuresRepositories = mvn:org.apache.karaf.features/standard/3.0.7/xml/features,mvn:org.apache.karaf.features/enterprise/3.0.7/xml/features,mvn:org.ops4j.pax.web/pax-web-features/3.2.9/xml/features,mvn:org.apache.karaf.features/spring/3.0.7/xml/features,mvn:org.opendaylight.integration/features-integration-index/0.5.2-Boron-SR2/xml/features # # Comma separated list of features to install at startup # -featuresBoot=config,standard,region,package,kar,ssh,management,odl-restconf-all,odl-aaa-authn,odl-dlux-all,odl-ovsdb-openstack,odl-base-all,odl-nsf-all,odl-adsal-northbound,odl-mdsal-apidocs,odl-ovsdb-northbound,odl-dlux-core +featuresBoot=config,standard,region,package,kar,ssh,management,odl-restconf-all,odl-aaa-authn,odl-dlux-all,odl-ovsdb-openstack,odl-mdsal-apidocs,odl-dlux-core,odl-openflowplugin-nxm-extensions # # Defines if the boot features are started in asynchronous mode (in a dedicated thread) diff --git a/deploy/adapters/ansible/roles/odl_cluster/vars/main.yml b/deploy/adapters/ansible/roles/odl_cluster/vars/main.yml index 4ee7ecf7..fac2a11e 100755 --- a/deploy/adapters/ansible/roles/odl_cluster/vars/main.yml +++ b/deploy/adapters/ansible/roles/odl_cluster/vars/main.yml @@ -14,9 +14,9 @@ odl_api_port: 8181 # odl_pkg_url: https://nexus.opendaylight.org/content/groups/public/org/ # opendaylight/integration/distribution-karaf/0.3.0-Lithium/ # distribution-karaf-0.3.0-Lithium.tar.gz -odl_pkg_url: distribution-karaf-0.5.0-Boron.tar.gz -odl_pkg_name: distribution-karaf-0.5.0-Boron.tar.gz -odl_home: "/opt/opendaylight-0.5.0/" +odl_pkg_url: distribution-karaf-0.5.2-Boron-SR2.tar.gz +odl_pkg_name: distribution-karaf-0.5.2-Boron-SR2.tar.gz +odl_home: "/opt/opendaylight/" odl_base_features: - config - standard |