Fix apache + uwsgi for keystone

The vars port specification in the keystone-httpd.conf.j2 were
incorrectly referencing vars instead of strings, causing failures.

Additionally, the conf created for uwsgi and apache includes all the
WSGI settings - which is not in line with how it should look.

Encasing the WSGI settings in an if statement so that it lines up with
the example conf file from the keystone docs.

We will also need to enable the proxy_http module for uwsgi with apache.

Change-Id: I64eec88452333eee6397ccbad13cd80a5275e607
This commit is contained in:
Andy McCrae 2016-09-01 11:19:01 +01:00
parent 13a6085bca
commit 38dbd423d6
3 changed files with 34 additions and 13 deletions

View File

@ -99,3 +99,26 @@
- ansible_pkg_mgr == 'apt'
notify:
- Restart service
## NOTE(cloudnull):
## Module enable/disable process is only functional on Debian based systems.
- name: Enable/disable proxy_http
apache2_module:
name: proxy_http
state: "{{ (keystone_mod_wsgi_enabled | bool) | ternary('absent', 'present') }}"
when:
- ansible_pkg_mgr == 'apt'
notify:
- Restart service
## NOTE(andymccr):
## We need to enable a module for httpd on RedHat/CentOS using LoadModule inside conf files
- name: Enable/disable proxy_uwsgi_module
lineinfile:
dest: '/etc/httpd/conf.modules.d/00-proxy.conf'
line: 'LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so'
state: "{{ (keystone_mod_wsgi_enabled | bool) | ternary('absent', 'present') }}"
when:
- ansible_pkg_mgr == 'yum'
notify:
- Restart service

View File

@ -120,7 +120,7 @@
tags:
- keystone-install
- keystone-config
when: not keystone_apache_enabled | bool
when: not keystone_mod_wsgi_enabled | bool
- name: Flush handlers
meta: flush_handlers

View File

@ -1,6 +1,7 @@
# {{ ansible_managed }}
<VirtualHost *:{{ keystone_service_port }}>
{% if keystone_mod_wsgi_enabled | bool -%}
WSGIDaemonProcess keystone-service user={{ keystone_system_user_name }} group={{ keystone_system_group_name }} processes={{ keystone_wsgi_processes }} threads={{ keystone_wsgi_threads }} display-name=%{GROUP} python-path={{ keystone_bin | dirname }}/lib/python2.7/site-packages
WSGIProcessGroup keystone-service
@ -57,20 +58,19 @@
WSGIScriptAliasMatch ^(/v3/OS-FEDERATION/identity_providers/.*?/protocols/.*?/auth)$ /var/www/cgi-bin/keystone/main/$1
{% endif %}
{% if keystone_mod_wsgi_enabled | bool -%}
<Directory /var/www/cgi-bin/keystone>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
{% else %}
ProxyPass / uwsgi://127.0.0.1:{{ keystone_uwsgi_ports[keystone-wsgi-public]["socket"] }}/
{% endif %}
{% else %}
ProxyPass / uwsgi://127.0.0.1:{{ keystone_uwsgi_ports['keystone-wsgi-public']['socket'] }}/
{% endif %}
</VirtualHost>
<VirtualHost *:{{ keystone_admin_port }}>
{% if keystone_mod_wsgi_enabled | bool -%}
WSGIDaemonProcess keystone-admin user={{ keystone_system_user_name }} group={{ keystone_system_group_name }} processes={{ keystone_wsgi_processes }} threads={{ keystone_wsgi_threads }} display-name=%{GROUP} python-path={{ keystone_bin | dirname }}/lib/python2.7/site-packages
WSGIProcessGroup keystone-admin
@ -101,19 +101,17 @@
SSLOptions +StdEnvVars +ExportCertData
{% endif %}
{% if keystone_mod_wsgi_enabled | bool -%}
<Directory /var/www/cgi-bin/keystone>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
{% else -%}
ProxyPass / uwsgi://127.0.0.1:{{ keystone_uwsgi_ports[keystone-wsgi-admin]["socket"] }}/
{% endif %}
{% else -%}
ProxyPass / uwsgi://127.0.0.1:{{ keystone_uwsgi_ports['keystone-wsgi-admin']["socket"] }}/
{% endif %}
</VirtualHost>
{% if not keystone_mod_wsgi_enabled | bool -%}
ProxyPass /identity uwsgi://127.0.0.1:{{ keystone_uwsgi_ports[keystone-wsgi-public]['socket'] }}/
ProxyPass /identity_admin uwsgi://127.0.0.1:{{ keystone_uwsgi_ports[keystone-wsgi-admin]['socket'] }}/
ProxyPass /identity uwsgi://127.0.0.1:{{ keystone_uwsgi_ports['keystone-wsgi-public']['socket'] }}/
ProxyPass /identity_admin uwsgi://127.0.0.1:{{ keystone_uwsgi_ports['keystone-wsgi-admin']['socket'] }}/
{% endif %}