Moved adjustment into its own directory.

* Keystone can now be configured for eventlet or httpd.
* Keystone can adjust number of processes/threads in httpd
* Keystone can adjust number of workers in eventlet
* Nova can adjust it's number of workers.

Usage Examples:
* ansible-playbook -i hosts adjustment/site.yml -e "workers=12" -e "deployment=httpd"
* ansible-playbook -i hosts adjustment/site.yml -e "workers=12" -e "deployment=eventlet"
This commit is contained in:
Alex Krzos 2015-11-24 12:12:03 -05:00
parent 850e57e1fe
commit a27f460186
8 changed files with 217 additions and 42 deletions

View File

@ -0,0 +1,25 @@
# Copyright 2013 OpenStack Foundation
#
# Licensed 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.
import os
from keystone.server import wsgi as wsgi_server
name = os.path.basename(__file__)
# NOTE(ldbragst): 'application' is required in this context by WSGI spec.
# The following is a reference to Python Paste Deploy documentation
# http://pythonpaste.org/deploy/
application = wsgi_server.initialize_application(name)

View File

@ -0,0 +1,117 @@
---
#
# Keystone tasks for browbeat
# * Can change from eventlet to httpd
# * Can change eventlet worker count
# * Can change httpd process and thread count
#
- name: Get keystone admin ip address
command: crudini --get /etc/keystone/keystone.conf DEFAULT admin_bind_host
register: admin_ip_addr
- name: Get keystone admin ip address
command: crudini --get /etc/keystone/keystone.conf DEFAULT public_bind_host
register: public_ip_addr
- name: Unmanage Keystone Service from pacemaker
shell: pcs resource unmanage openstack-keystone
- name: Unmanage httpd Service from pacemaker
shell: pcs resource unmanage httpd
- name: Stop Keystone Service
service: name=openstack-keystone state=stopped
- name: Stop httpd services
service: name=httpd state=stopped
- name: Configure eventlet workers
ini_file:
dest: /etc/keystone/keystone.conf
mode: 0640
section: "{{ item.section }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
backup: yes
with_items:
- { section: DEFAULT, option: verbose, value: False }
- { section: DEFAULT, option: debug, value: False }
- { section: DEFAULT, option: public_workers, value: "{{ workers }}" }
- { section: DEFAULT, option: admin_workers, value: "{{ workers }}" }
when: "'eventlet' in '{{ deployment }}'"
- name: Unconfigure keystone in httpd if eventlet
file:
path: /etc/httpd/conf.d/10-keystone_wsgi_{{ item }}.conf
state: absent
with_items:
- admin
- main
when: "'eventlet' in '{{ deployment }}'"
- name: Create keystone in httpd wsgi directory
file:
path: /var/www/cgi-bin/keystone
state: directory
owner: keystone
group: keystone
when: "'httpd' in '{{ deployment }}'"
- name: Copy Keystone in httpd files over
copy:
src: keystone_httpd
dest: /var/www/cgi-bin/keystone/{{ item }}
owner: keystone
group: keystone
mode: 0744
with_items:
- admin
- main
when: "'httpd' in '{{ deployment }}'"
- name: Configure httpd processes/threads
template:
src=keystone_wsgi.conf.j2
dest=/etc/httpd/conf.d/10-keystone_wsgi_{{ item.interface }}.conf
owner=root
group=root
mode=0644
with_items:
- ip_address: "{{ admin_ip_addr.stdout }}"
interface: "admin"
processes: "{{ workers }}"
port: 35357
threads: "{{ threads }}"
- ip_address: "{{ public_ip_addr.stdout }}"
interface: "main"
processes: "{{ workers }}"
port: 5000
threads: "{{ threads }}"
when: "'httpd' in '{{ deployment }}'"
- name: Configure httpd ports.conf for keystone
template:
src=keystone_ports.conf.j2
dest=/etc/httpd/conf/ports.conf
owner=root
group=root
mode=0644
with_items:
- admin_ip_address: "{{ admin_ip_addr.stdout }}"
public_ip_address: "{{ public_ip_addr.stdout }}"
deployment: "{{ deployment }}"
- name: Start Keystone services
service: name=openstack-keystone state=started
when: "'eventlet' in '{{ deployment }}'"
- name: Start httpd services
service: name=httpd state=started
- name: Manage Keystone Service from pacemaker
shell: pcs resource manage openstack-keystone
when: "'eventlet' in '{{ deployment }}'"
- name: Manage httpd Service from pacemaker
shell: pcs resource manage openstack-keystone

View File

@ -0,0 +1,7 @@
# {{ ansible_managed }}
Listen {{ item.public_ip_address }}:80
{% if 'httpd' in item.deployment %}
Listen {{ item.admin_ip_address }}:35357
Listen {{ item.public_ip_address }}:5000
{% endif %}

View File

@ -0,0 +1,23 @@
<VirtualHost {{ item.ip_address }}:35357>
ServerName keystone_wsgi_{{ item.interface }}
## Vhost docroot
DocumentRoot "/var/www/cgi-bin/keystone"
## Directories, there should at least be a declaration for /var/www/cgi-bin/keystone
<Directory "/var/www/cgi-bin/keystone">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
</Directory>
## Logging
ErrorLog "/var/log/httpd/keystone_wsgi_{{ item.interface }}_error.log"
LogLevel info
ServerSignature Off
CustomLog "/var/log/httpd/keystone_wsgi_{{ item.interface }}_access.log" combined
WSGIDaemonProcess keystone_{{ item.interface }} display-name=keystone-{{ item.interface }} group=keystone processes={{ item.processes }} threads={{ item.threads }} user=keystone
WSGIProcessGroup keystone_{{ item.interface }}
WSGIScriptAlias / "/var/www/cgi-bin/keystone/{{ item.interface }}"
</VirtualHost>

View File

@ -0,0 +1,42 @@
---
#
# Nova tasks for Browbeat
# * Can change worker count
#
- name: Ensure nova.conf is properly configured
ini_file:
dest: /etc/nova/nova.conf
mode: 0640
section: "{{ item.section }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
backup: yes
with_items:
- { section: DEFAULT, option: verbose, value: False }
- { section: DEFAULT, option: debug, value: False }
- { section: DEFAULT, option: ec2_workers, value: "{{ workers }}" }
- { section: DEFAULT, option: osapi_compute_workers, value: "{{ workers }}" }
- { section: DEFAULT, option: metadata_workers, value: "{{ workers }}" }
- { section: conductor, option: workers, value: "{{ workers }}" }
- name: Unmanage Nova Service from pacemaker
shell: pcs resource unmanage {{ item }}
with_items:
- openstack-nova-conductor
- openstack-nova-api
- openstack-nova-scheduler
- name: Restart Nova services
service: name={{ item }} state=restarted
with_items:
- openstack-nova-conductor
- openstack-nova-api
- openstack-nova-scheduler
- name: Manage Nova Service from pacemaker
shell: pcs resource manage {{ item }}
with_items:
- openstack-nova-conductor
- openstack-nova-api
- openstack-nova-scheduler

View File

@ -6,7 +6,9 @@
- hosts: controllers
remote_user: heat-admin
vars:
install: False
deployment: eventlet
workers: 24
threads: 6
roles:
- nova
- keystone

View File

@ -16,27 +16,3 @@
register: keystone_token_provider
changed_when: no
ignore_errors: True
- name: Ensure keystone.conf is properly configured
ini_file:
dest: /etc/keystone/keystone.conf
mode: 0640
section: "{{ item.section }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
backup: yes
with_items:
- { section: DEFAULT, option: verbose, value: False }
- { section: DEFAULT, option: debug, value: False }
- { section: DEFAULT, option: public_workers, value: "{{ num_workers }}" }
- { section: DEFAULT, option: admin_workers, value: "{{ num_workers }}" }
when: not install
- name: Unmanage Keystone Service from pacemaker
shell: pcs resource unmanage openstack-keystone
- name: Restart Keystone services
service: name=openstack-keystone state=restarted
- name: Manage Keystone Service from pacemaker
shell: pcs resource manage openstack-keystone

View File

@ -22,23 +22,6 @@
shell: sed -i '/connection = mysql/s/$/?connmon_service=default/' /etc/nova/nova.conf
when: connmon and install and nova_connmon_service.rc == 1
- name: Ensure nova.conf is properly configured
ini_file:
dest: /etc/nova/nova.conf
mode: 0640
section: "{{ item.section }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
backup: yes
with_items:
- { section: DEFAULT, option: verbose, value: False }
- { section: DEFAULT, option: debug, value: False }
- { section: DEFAULT, option: ec2_workers, value: "{{ num_workers }}" }
- { section: DEFAULT, option: osapi_compute_workers, value: "{{ num_workers }}" }
- { section: DEFAULT, option: workers, value: "{{ num_workers }}" }
- { section: DEFAULT, option: metadata_workers, value: "{{ num_workers }}" }
- { section: conductor, option: workers, value: "{{ num_workers }}" }
- name: Unmanage Nova Service from pacemaker
shell: pcs resource unmanage {{ item }}
with_items: