diff --git a/ansible/roles/cloudkitty/handlers/main.yml b/ansible/roles/cloudkitty/handlers/main.yml
index 82a67724a5..339442e422 100644
--- a/ansible/roles/cloudkitty/handlers/main.yml
+++ b/ansible/roles/cloudkitty/handlers/main.yml
@@ -19,6 +19,7 @@
- service.enabled | bool
- config_json.changed | bool
or cloudkitty_conf.changed | bool
+ or cloudkitty_conf_wsgi.changed | bool
or policy_json.changed | bool
or cloudkitty_api_container.changed | bool
diff --git a/ansible/roles/cloudkitty/tasks/config.yml b/ansible/roles/cloudkitty/tasks/config.yml
index 10923109f7..4b04cffedd 100644
--- a/ansible/roles/cloudkitty/tasks/config.yml
+++ b/ansible/roles/cloudkitty/tasks/config.yml
@@ -44,6 +44,19 @@
- Restart cloudkitty-api container
- Restart cloudkitty-processor container
+- name: Copying over wsgi-cloudkitty.conf
+ vars:
+ service: "{{ cloudkitty_services['cloudkitty-api'] }}"
+ template:
+ src: "wsgi-cloudkitty.conf.j2"
+ dest: "{{ node_config_directory }}/cloudkitty-api/wsgi-cloudkitty.conf"
+ register: cloudkitty_conf_wsgi
+ when:
+ - inventory_hostname in groups[service.group]
+ - service.enabled | bool
+ notify:
+ - Restart cloudkitty-api container
+
- name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/cloudkitty/policy.json"
run_once: True
diff --git a/ansible/roles/cloudkitty/templates/cloudkitty-api.json.j2 b/ansible/roles/cloudkitty/templates/cloudkitty-api.json.j2
index 0b7a828a13..cccc9350a1 100644
--- a/ansible/roles/cloudkitty/templates/cloudkitty-api.json.j2
+++ b/ansible/roles/cloudkitty/templates/cloudkitty-api.json.j2
@@ -1,5 +1,7 @@
+{% set cloudkitty_cmd = 'apache2' if kolla_base_distro in ['ubuntu', 'debian'] else 'httpd' %}
+{% set cloudkitty_dir = 'apache2/conf-enabled' if kolla_base_distro in ['ubuntu', 'debian'] else 'httpd/conf.d' %}
{
- "command": "cloudkitty-api --config-file /etc/cloudkitty/cloudkitty.conf",
+ "command": "{{ cloudkitty_cmd }} -DFOREGROUND",
"config_files": [
{
"source": "{{ container_config_directory }}/cloudkitty.conf",
@@ -7,6 +9,12 @@
"owner": "cloudkitty",
"perm": "0600"
},
+ {
+ "source": "{{ container_config_directory }}/wsgi-cloudkitty.conf",
+ "dest": "/etc/{{ cloudkitty_dir }}/wsgi-cloudkitty.conf",
+ "owner": "cloudkitty",
+ "perm": "0600"
+ },
{
"source": "{{ container_config_directory }}/policy.json",
"dest": "/etc/cloudkitty/policy.json",
diff --git a/ansible/roles/cloudkitty/templates/cloudkitty.conf.j2 b/ansible/roles/cloudkitty/templates/cloudkitty.conf.j2
index 90b121f8f7..6802369a5b 100644
--- a/ansible/roles/cloudkitty/templates/cloudkitty.conf.j2
+++ b/ansible/roles/cloudkitty/templates/cloudkitty.conf.j2
@@ -3,6 +3,11 @@ debug = {{ cloudkitty_logging_debug }}
log_dir = /var/log/kolla/cloudkitty
+{% if service_name == 'cloudkitty-api' %}
+# Force cloudkitty-api.log or will use app.wsgi
+log_file = /var/log/kolla/cloudkitty/cloudkitty-api.log
+{% endif %}
+
transport_url = rabbit://{% for host in groups['rabbitmq'] %}{{ rabbitmq_user }}:{{ rabbitmq_password }}@{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ rabbitmq_port }}{% if not loop.last %},{% endif %}{% endfor %}
[database]
diff --git a/ansible/roles/cloudkitty/templates/wsgi-cloudkitty.conf.j2 b/ansible/roles/cloudkitty/templates/wsgi-cloudkitty.conf.j2
new file mode 100644
index 0000000000..c6926a303d
--- /dev/null
+++ b/ansible/roles/cloudkitty/templates/wsgi-cloudkitty.conf.j2
@@ -0,0 +1,20 @@
+{% set python_path = '/usr/lib/python2.7/site-packages' if kolla_install_type == 'binary' else '/var/lib/kolla/venv/lib/python2.7/site-packages' %}
+Listen {{ api_interface_address }}:{{ cloudkitty_api_port }}
+
+TraceEnable off
+
+
+
+ ErrorLog "/var/log/kolla/cloudkitty/cloudkitty-api-error.log"
+ LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" logformat
+ CustomLog "/var/log/kolla/cloudkitty/cloudkitty-api-access.log" logformat
+ WSGIApplicationGroup %{GLOBAL}
+ WSGIDaemonProcess cloudkitty group=cloudkitty processes={{ openstack_service_workers }} threads=1 user=cloudkitty python-path={{ python_path }}
+ WSGIProcessGroup cloudkitty
+ WSGIScriptAlias / "{{ python_path }}/cloudkitty/api/app.wsgi"
+
+
+ Require all granted
+
+
+
diff --git a/ansible/roles/common/templates/conf/filter/01-rewrite.conf.j2 b/ansible/roles/common/templates/conf/filter/01-rewrite.conf.j2
index 956203f176..3c094d40f9 100644
--- a/ansible/roles/common/templates/conf/filter/01-rewrite.conf.j2
+++ b/ansible/roles/common/templates/conf/filter/01-rewrite.conf.j2
@@ -1,7 +1,7 @@
@type rewrite_tag_filter
capitalize_regex_backreference yes
- rewriterule1 programname ^(cinder-api-access|gnocchi-api-access|horizon-access|keystone-apache-admin-access|keystone-apache-public-access|placement-api-access|panko-api-access)$ apache_access
+ rewriterule1 programname ^(cinder-api-access|cloudkitty-api-access|gnocchi-api-access|horizon-access|keystone-apache-admin-access|keystone-apache-public-access|placement-api-access|panko-api-access)$ apache_access
rewriterule2 programname ^(aodh_wsgi_access | zun_api_wsgi_access)$ wsgi_access
rewriterule3 programname ^(nova-api|nova-compute|nova-conductor|nova-consoleauth|nova-manage|nova-novncproxy|nova-scheduler|nova-placement-api|placement-api|privsep-helper)$ openstack_python
rewriterule4 programname ^(sahara-api|sahara-engine)$ openstack_python