Matt Thompson da560992ba Run horizon-manage.py script as {{ system_user }}
Currently, we seem to always have 1/3 horizon nodes where
/var/lib/horizon/.secret_key_store is owned by root which breaks
horizon logins.  This appears to be a result of running
horizon-manage.py syncdb as root (which only happens on 1/3 nodes).
This change moves all horizon-manage.py commands to run as
{{ system_user }}, which requires us to also pre-create some dirs
owned by {{ system_user }} by adding them to container_directories so
that the horizon-manage.py commands will all complete successfully.

Lastly, we remove the creation of /etc/horizon and the chown of files
in {{ install_lib_dir }}/static in heat_common role since those have
been added to container_directories.

Change-Id: I335743fe253bd501401208baf6aa8e772ba641f0
2014-12-04 16:51:41 -06:00

64 lines
2.1 KiB
YAML

---
# Copyright 2014, Rackspace US, Inc.
#
# 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.
# The Horizon config files should be replaced for the JUNO release
# juno_revision: true
- name: Setup Horizon config(s)
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: "{{ system_user }}"
group: "{{ system_group }}"
mode: "{{ item.mode }}"
with_items:
- { src: "local_settings.py", dest: "/etc/horizon/local_settings.py", mode: "0644" }
- name: Copy manage.py to /usr/local/bin/horizon-manage.py
command: rsync -ci {{ git_dest }}/manage.py /usr/local/bin/horizon-manage.py
register: rsync_result
changed_when: rsync_result.stdout != ""
- name: Set permissions on /usr/local/bin/horizon-manage.py
file:
path: /usr/local/bin/horizon-manage.py
owner: root
group: root
mode: 0755
- name: Remove old links deployed in RPC 9.0.0
file: path={{ item }} state=absent
with_items:
- "{{ install_lib_dir }}/openstack_dashboard/static/bootstrap/js"
- "{{ install_lib_dir }}/openstack_dashboard/static/horizon"
# /opt/horizon/lib/python2.7/site-packages/manage.py
- name: Collect and compress static files
command: "{{ item }}"
sudo: yes
sudo_user: "{{ system_user }}"
with_items:
- horizon-manage.py collectstatic --noinput
- horizon-manage.py compress --force
- name: Create horizon links
file:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: "{{ system_user }}"
group: "{{ system_group }}"
state: "link"
with_items:
- { src: "/etc/horizon/local_settings.py", dest: "{{ install_lib_dir }}/openstack_dashboard/local/local_settings.py" }