# 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
max_fail_percentage: 0
roles:
- memcached
+ - apache
- database
- mq
- keystone
- - apache
- nova-controller
- neutron-controller
- cinder-controller
+++ /dev/null
-##############################################################################
-# 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
+++ /dev/null
-Listen {{ internal_ip }}:80
-Listen {{ internal_ip }}:5000
-Listen {{ internal_ip }}:35357
- 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
when: mount_info.stdout.find('images') == -1
retries: 5
delay: 3
+ tags:
+ - recovery
- 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
- 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:
cron_path: "/var/spool/cron/crontabs"
packages:
- - keystone
- apache2
- libapache2-mod-wsgi
- python-keystone
- python-openstackclient
+ - keystone
services:
- apache2
---
packages_noarch:
- python-keystoneclient
+ - python3-keystoneclient
services_noarch: []
os_services:
--- /dev/null
+##############################################################################
+# 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
}
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() {