From 2ea87ebdb7b15011c2825d23dc160ef0aa76fa0e Mon Sep 17 00:00:00 2001 From: Sam Yaple Date: Thu, 15 Oct 2015 08:54:36 +0000 Subject: [PATCH] Use memcache for consoleauth and horizon Unfortunately there was no was to avoid memcache for consoleauth, so we might as well take advantage of it for Horizon as well. Change-Id: Idd338a025b031f6b50fe0c9f03c2c8d862f9d4c0 Closes-Bug: #1504606 Closes-Bug: #1504800 --- ansible/group_vars/all.yml | 1 + ansible/roles/horizon/templates/local_settings.j2 | 12 +++--------- ansible/roles/nova/templates/nova.conf.j2 | 3 +++ ansible/roles/swift/meta/main.yml | 1 - ansible/site.yml | 4 ++++ docker/openstack-base/Dockerfile.j2 | 3 ++- etc/kolla/passwords.yml | 1 + 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 76dba6f08b..845c7e4432 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -134,6 +134,7 @@ openstack_auth_v2: enable_glance: "yes" enable_haproxy: "yes" enable_keystone: "yes" +enable_memcached: "yes" enable_mariadb: "yes" enable_neutron: "yes" enable_nova: "yes" diff --git a/ansible/roles/horizon/templates/local_settings.j2 b/ansible/roles/horizon/templates/local_settings.j2 index baf53dcdc6..f0ab43030a 100644 --- a/ansible/roles/horizon/templates/local_settings.j2 +++ b/ansible/roles/horizon/templates/local_settings.j2 @@ -117,21 +117,15 @@ LOCAL_PATH = '/tmp' # (usually behind a load-balancer). Either you have to make sure that a session # gets all requests routed to the same dashboard instance or you set the same # SECRET_KEY for all of them. -SECRET_KEY='605f2a71e76a686b70eb' +SECRET_KEY='{{ horizon_secret_key }}' # We recommend you use memcached for development; otherwise after every reload # of the django development server, you will have to login again. To use # memcached set CACHES to something like -#CACHES = { -# 'default': { -# 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', -# 'LOCATION': '127.0.0.1:11211', -# } -#} - CACHES = { 'default': { - 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', + 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', + 'LOCATION': '{% for host in groups['memcached'] %}{{ hostvars[host]['ansible_' + api_interface]['ipv4']['address'] }}:{{ memcached_port }}{% if not loop.last %},{% endif %}{% endfor %}', } } diff --git a/ansible/roles/nova/templates/nova.conf.j2 b/ansible/roles/nova/templates/nova.conf.j2 index 98300fc03a..b8855d3bc6 100644 --- a/ansible/roles/nova/templates/nova.conf.j2 +++ b/ansible/roles/nova/templates/nova.conf.j2 @@ -32,6 +32,9 @@ linuxnet_interface_driver = nova.network.linux_net.BridgeInterfaceDriver allow_resize_to_same_host = true +memcached_servers = {% for host in groups['memcached'] %}{{ hostvars[host]['ansible_' + api_interface]['ipv4']['address'] }}:{{ memcached_port }}{% if not loop.last %},{% endif %}{% endfor %} + + # Though my_ip is not used directly, lots of other variables use $my_ip my_ip = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} diff --git a/ansible/roles/swift/meta/main.yml b/ansible/roles/swift/meta/main.yml index f478e69120..6b4fff8fef 100644 --- a/ansible/roles/swift/meta/main.yml +++ b/ansible/roles/swift/meta/main.yml @@ -1,4 +1,3 @@ --- dependencies: - { role: common } - - { role: memcached } diff --git a/ansible/site.yml b/ansible/site.yml index 00e8f64f99..f89884f23a 100755 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -7,6 +7,10 @@ roles: - { role: haproxy, tags: haproxy, when: enable_haproxy | bool } +- hosts: memcached + roles: + - { role: memcached, tags: memcache, memcached, when: enable_memcached | bool } + - hosts: mariadb roles: - { role: mariadb, tags: mariadb, when: enable_mariadb | bool } diff --git a/docker/openstack-base/Dockerfile.j2 b/docker/openstack-base/Dockerfile.j2 index 345a1b604e..a29f0ad846 100644 --- a/docker/openstack-base/Dockerfile.j2 +++ b/docker/openstack-base/Dockerfile.j2 @@ -93,6 +93,7 @@ RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ python-tuskarclient \ python-zaqarclient \ python-openstackclient \ - MySQL-python + MySQL-python \ + python-memcached {% endif %} diff --git a/etc/kolla/passwords.yml b/etc/kolla/passwords.yml index 04a30e7975..03afac043f 100644 --- a/etc/kolla/passwords.yml +++ b/etc/kolla/passwords.yml @@ -56,6 +56,7 @@ murano_keystone_password: "password" ironic_database_password: "password" ironic_keystone_password: "password" +horizon_secret_key: "password" #################### # RabbitMQ options