From 0d4fc38c569df7a417065fd3094c7477660eb18c Mon Sep 17 00:00:00 2001 From: liyuenan Date: Thu, 20 Oct 2016 10:41:59 +0800 Subject: Edit the docker file and adjust HA yml JIRA: COMPASS-491 Change-Id: Ibca46dca0ca614b9a6e7eb3fe5b9d5c8ca26c006 Signed-off-by: liyuenan --- build/templates/Debian_xenial_newton.tmpl | 3 +- .../HA-ansible-multinodes.yml | 2 +- .../roles/apache/tasks/main.yml | 31 ------------- .../roles/apache/templates/ports.conf.j2 | 3 -- .../roles/glance/tasks/nfs.yml | 6 +++ .../roles/keystone/tasks/keystone_install.yml | 8 ++-- .../roles/keystone/vars/Debian.yml | 2 +- .../roles/keystone/vars/main.yml | 1 + .../neutron-controller/tasks/neutron_install.yml | 49 +++++++++++++++++++++ .../roles/odl_cluster/files/odl-aaa-moon.tar.gz | Bin 619269 -> 0 bytes .../roles/swift/files/swift-lib.tar.gz | Bin 499553 -> 0 bytes deploy/compass_vm.sh | 27 +++++++----- 12 files changed, 79 insertions(+), 53 deletions(-) delete mode 100755 deploy/adapters/ansible/openstack_newton_xenial/roles/apache/tasks/main.yml delete mode 100644 deploy/adapters/ansible/openstack_newton_xenial/roles/apache/templates/ports.conf.j2 create mode 100644 deploy/adapters/ansible/openstack_newton_xenial/roles/neutron-controller/tasks/neutron_install.yml delete mode 100644 deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/files/odl-aaa-moon.tar.gz delete mode 100644 deploy/adapters/ansible/openstack_newton_xenial/roles/swift/files/swift-lib.tar.gz diff --git a/build/templates/Debian_xenial_newton.tmpl b/build/templates/Debian_xenial_newton.tmpl index e10d4e22..84f28700 100644 --- a/build/templates/Debian_xenial_newton.tmpl +++ b/build/templates/Debian_xenial_newton.tmpl @@ -5,7 +5,8 @@ set -ex # add openstack $OPV repo apt-get update && apt-get install -y software-properties-common -# sudo add-apt-repository -y cloud-archive:$OPV +add-apt-repository -y cloud-archive:$OPV +apt-get update && apt-get -y dist-upgrade apt-get install -d nova-compute-kvm -y #make pernoca database diff --git a/deploy/adapters/ansible/openstack_newton_xenial/HA-ansible-multinodes.yml b/deploy/adapters/ansible/openstack_newton_xenial/HA-ansible-multinodes.yml index 9e8ec15b..9be0c384 100644 --- a/deploy/adapters/ansible/openstack_newton_xenial/HA-ansible-multinodes.yml +++ b/deploy/adapters/ansible/openstack_newton_xenial/HA-ansible-multinodes.yml @@ -61,10 +61,10 @@ max_fail_percentage: 0 roles: - memcached + - apache - database - mq - keystone - - apache - nova-controller - neutron-controller - cinder-controller diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/apache/tasks/main.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/apache/tasks/main.yml deleted file mode 100755 index ad1d544f..00000000 --- a/deploy/adapters/ansible/openstack_newton_xenial/roles/apache/tasks/main.yml +++ /dev/null @@ -1,31 +0,0 @@ -############################################################################## -# 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 -############################################################################## ---- -- include_vars: "{{ ansible_os_family }}.yml" - -- name: install packages - action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest update_cache=yes" - with_items: packages | union(packages_noarch) - when ansible_os_family != 'Debian' - -- name: assure listen port exist - template: - dest: '{{ apache_config_dir }}/ports.conf' - src: ports.conf.j2 - notify: - - restart apache related services - -- name: remove default listen port on centos - lineinfile: - dest: /etc/httpd/conf/httpd.conf - state: absent - regexp: 'Listen 80' - when: ansible_os_family == 'RedHat' - -- meta: flush_handlers diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/apache/templates/ports.conf.j2 b/deploy/adapters/ansible/openstack_newton_xenial/roles/apache/templates/ports.conf.j2 deleted file mode 100644 index f6c9c8b1..00000000 --- a/deploy/adapters/ansible/openstack_newton_xenial/roles/apache/templates/ports.conf.j2 +++ /dev/null @@ -1,3 +0,0 @@ -Listen {{ internal_ip }}:80 -Listen {{ internal_ip }}:5000 -Listen {{ internal_ip }}:35357 diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/glance/tasks/nfs.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/glance/tasks/nfs.yml index 07dfacdd..1d13bfe7 100644 --- a/deploy/adapters/ansible/openstack_newton_xenial/roles/glance/tasks/nfs.yml +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/glance/tasks/nfs.yml @@ -42,10 +42,14 @@ - name: get mount info command: mount register: mount_info + tags: + - recovery - name: get nfs server shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf register: ip_info + tags: + - recovery - name: restart host nfs service service: name={{ item }} state=restarted enabled=yes @@ -59,3 +63,5 @@ when: mount_info.stdout.find('images') == -1 retries: 5 delay: 3 + tags: + - recovery diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/keystone/tasks/keystone_install.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/keystone/tasks/keystone_install.yml index 79d02729..8ff087ce 100644 --- a/deploy/adapters/ansible/openstack_newton_xenial/roles/keystone/tasks/keystone_install.yml +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/keystone/tasks/keystone_install.yml @@ -66,7 +66,7 @@ - name: update apache2 configs template: src: wsgi-keystone.conf.j2 - dest: '{{ apache_config_dir }}/sites-available/wsgi-keystone.conf' + dest: '{{ apache_config_dir }}/sites-available/keystone.conf' when: ansible_os_family == 'Debian' notify: - restart keystone services @@ -74,15 +74,15 @@ - name: update apache2 configs template: src: wsgi-keystone.conf.j2 - dest: '{{ apache_config_dir }}/wsgi-keystone.conf' + dest: '{{ apache_config_dir }}/keystone.conf' when: ansible_os_family == 'RedHat' notify: - restart keystone services - name: enable keystone server file: - src: "{{ apache_config_dir }}/sites-available/wsgi-keystone.conf" - dest: "{{ apache_config_dir }}/sites-enabled/wsgi-keystone.conf" + src: "{{ apache_config_dir }}/sites-available/keystone.conf" + dest: "{{ apache_config_dir }}/sites-enabled/keystone.conf" state: "link" when: ansible_os_family == 'Debian' notify: diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/keystone/vars/Debian.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/keystone/vars/Debian.yml index 6000c6fd..89bfbe0a 100644 --- a/deploy/adapters/ansible/openstack_newton_xenial/roles/keystone/vars/Debian.yml +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/keystone/vars/Debian.yml @@ -11,11 +11,11 @@ cron_path: "/var/spool/cron/crontabs" packages: - - keystone - apache2 - libapache2-mod-wsgi - python-keystone - python-openstackclient + - keystone services: - apache2 diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/keystone/vars/main.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/keystone/vars/main.yml index ac548a09..79ed06fe 100644 --- a/deploy/adapters/ansible/openstack_newton_xenial/roles/keystone/vars/main.yml +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/keystone/vars/main.yml @@ -9,6 +9,7 @@ --- packages_noarch: - python-keystoneclient + - python3-keystoneclient services_noarch: [] os_services: diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/neutron-controller/tasks/neutron_install.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/neutron-controller/tasks/neutron_install.yml new file mode 100644 index 00000000..0a30af7a --- /dev/null +++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/neutron-controller/tasks/neutron_install.yml @@ -0,0 +1,49 @@ +############################################################################## +# 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 +############################################################################## +--- +- include_vars: "{{ ansible_os_family }}.yml" + +- name: disable auto start + copy: + content: "#!/bin/sh\nexit 101" + dest: "/usr/sbin/policy-rc.d" + mode: 0755 + when: ansible_os_family == "Debian" + +- name: install controller-related neutron packages + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: packages | union(packages_noarch) + +- name: enable auto start + file: + path=/usr/sbin/policy-rc.d + state=absent + when: ansible_os_family == "Debian" + +- name: generate neutron control service list + lineinfile: dest=/opt/service create=yes line='{{ item }}' + with_items: services | union(services_noarch) + +- name: get tenant id to fill neutron.conf + shell: openstack project show \ + --os-username=admin \ + --os-password=console \ + --os-auth-url=http://{{ internal_vip.ip }}:35357/v2.0 \ + --os-tenant-name=admin \ + service | grep id | awk '{print $4}' + register: NOVA_ADMIN_TENANT_ID + +- name: update neutron conf + template: src=templates/neutron.conf dest=/etc/neutron/neutron.conf backup=yes + +- name: update ml2 plugin conf + template: src=templates/ml2_conf.ini dest=/etc/neutron/plugins/ml2/ml2_conf.ini backup=yes + +- name: ln plugin.ini + file: src=/etc/neutron/plugins/ml2/ml2_conf.ini dest=/etc/neutron/plugin.ini state=link diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/files/odl-aaa-moon.tar.gz b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/files/odl-aaa-moon.tar.gz deleted file mode 100644 index dd03749c..00000000 Binary files a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/files/odl-aaa-moon.tar.gz and /dev/null differ diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/swift/files/swift-lib.tar.gz b/deploy/adapters/ansible/openstack_newton_xenial/roles/swift/files/swift-lib.tar.gz deleted file mode 100644 index fdbb38fd..00000000 Binary files a/deploy/adapters/ansible/openstack_newton_xenial/roles/swift/files/swift-lib.tar.gz and /dev/null differ diff --git a/deploy/compass_vm.sh b/deploy/compass_vm.sh index 33e309c0..94b103f0 100755 --- a/deploy/compass_vm.sh +++ b/deploy/compass_vm.sh @@ -53,18 +53,21 @@ function exec_cmd_on_compass() { } function _inject_dashboard_conf() { - if [[ "$ENABLE_UBUNTU_THEME" == "true" ]]; then - cmd=" - sed -i '/enable_ubuntu_theme/d' /etc/compass/templates/ansible_installer/openstack_mitaka/vars/HA-ansible-multinodes.tmpl; \ - echo enable_ubuntu_theme: True >> /etc/compass/templates/ansible_installer/openstack_mitaka/vars/HA-ansible-multinodes.tmpl - " - else - cmd=" - sed -i '/enable_ubuntu_theme/d' /etc/compass/templates/ansible_installer/openstack_mitaka/vars/HA-ansible-multinodes.tmpl; \ - echo enable_ubuntu_theme: False >> /etc/compass/templates/ansible_installer/openstack_mitaka/vars/HA-ansible-multinodes.tmpl - " - fi - exec_cmd_on_compass $cmd + for os in mitaka mitaka_xenial newton_xenial; do + CONF_TEMPLATES_DIR=/etc/compass/templates/ansible_installer/openstack_$os/vars + if [[ "$ENABLE_UBUNTU_THEME" == "true" ]]; then + cmd=" + sed -i '/enable_ubuntu_theme/d' ${CONF_TEMPLATES_DIR}/HA-ansible-multinodes.tmpl; \ + echo enable_ubuntu_theme: True >> ${CONF_TEMPLATES_DIR}/HA-ansible-multinodes.tmpl + " + else + cmd=" + sed -i '/enable_ubuntu_theme/d' ${CONF_TEMPLATES_DIR}/HA-ansible-multinodes.tmpl; \ + echo enable_ubuntu_theme: False >> ${CONF_TEMPLATES_DIR}/HA-ansible-multinodes.tmpl + " + fi + exec_cmd_on_compass $cmd + done } function inject_compass_conf() { -- cgit 1.2.3-korg