From 787bf47d02b360f0f9b433c05ac49c80579011d4 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Sat, 14 Feb 2015 10:06:50 -0600 Subject: [PATCH] Convert existing roles into galaxy roles This change implements the blueprint to convert all roles and plays into a more generic setup, following upstream ansible best practices. Items Changed: * All tasks have tags. * All roles use namespaced variables. * All redundant tasks within a given play and role have been removed. * All of the repetitive plays have been removed in-favor of a more simplistic approach. This change duplicates code within the roles but ensures that the roles only ever run within their own scope. * All roles have been built using an ansible galaxy syntax. * The `*requirement.txt` files have been reformatted follow upstream Openstack practices. * Dynamically generated inventory is now more organized, this should assist anyone who may want or need to dive into the JSON blob that is created. In the inventory a properties field is used for items that customize containers within the inventory. * The environment map has been modified to support additional host groups to enable the seperation of infrastructure pieces. While the old infra_hosts group will still work this change allows for groups to be divided up into seperate chunks; eg: deployment of a swift only stack. * The LXC logic now exists within the plays. * etc/openstack_deploy/user_variables.yml has all password/token variables extracted into the separate file etc/openstack_deploy/user_secrets.yml in order to allow seperate security settings on that file. Items Excised: * All of the roles have had the LXC logic removed from within them which should allow roles to be consumed outside of the `os-ansible-deployment` reference architecture. Note: * the directory rpc_deployment still exists and is presently pointed at plays containing a deprecation warning instructing the user to move to the standard playbooks directory. * While all of the rackspace specific components and variables have been removed and or were refactored the repository still relies on an upstream mirror of Openstack built python files and container images. This upstream mirror is hosted at rackspace at "http://rpc-repo.rackspace.com" though this is not locked to and or tied to rackspace specific installations. This repository contains all of the needed code to create and/or clone your own mirror. DocImpact Co-Authored-By: Jesse Pretorius Closes-Bug: #1403676 Implements: blueprint galaxy-roles Change-Id: I03df3328b7655f0cc9e43ba83b02623d038d214e --- CONTRIBUTING.rst | 85 ++++ LICENSE | 202 ++++++++++ README.rst | 19 + defaults/main.yml | 83 ++++ files/horizon-manage.py | 23 ++ handlers/main.yml | 19 + meta/main.yml | 35 ++ tasks/horizon_apache.yml | 65 +++ tasks/horizon_db_setup.yml | 48 +++ tasks/horizon_install.yml | 43 ++ tasks/horizon_post_install.yml | 61 +++ tasks/horizon_pre_install.yml | 77 ++++ tasks/horizon_ssl_key_create.yml | 39 ++ tasks/horizon_ssl_key_distribute.yml | 36 ++ tasks/horizon_ssl_key_store.yml | 33 ++ tasks/horizon_ssl_self_signed.yml | 26 ++ tasks/horizon_ssl_user_provided.yml | 29 ++ tasks/main.yml | 37 ++ templates/horizon_apache_ports.conf.j2 | 5 + templates/horizon_local_settings.py.j2 | 533 +++++++++++++++++++++++++ templates/openstack_dashboard.conf.j2 | 49 +++ 21 files changed, 1547 insertions(+) create mode 100644 CONTRIBUTING.rst create mode 100644 LICENSE create mode 100644 README.rst create mode 100644 defaults/main.yml create mode 100644 files/horizon-manage.py create mode 100644 handlers/main.yml create mode 100644 meta/main.yml create mode 100644 tasks/horizon_apache.yml create mode 100644 tasks/horizon_db_setup.yml create mode 100644 tasks/horizon_install.yml create mode 100644 tasks/horizon_post_install.yml create mode 100644 tasks/horizon_pre_install.yml create mode 100644 tasks/horizon_ssl_key_create.yml create mode 100644 tasks/horizon_ssl_key_distribute.yml create mode 100644 tasks/horizon_ssl_key_store.yml create mode 100644 tasks/horizon_ssl_self_signed.yml create mode 100644 tasks/horizon_ssl_user_provided.yml create mode 100644 tasks/main.yml create mode 100644 templates/horizon_apache_ports.conf.j2 create mode 100644 templates/horizon_local_settings.py.j2 create mode 100644 templates/openstack_dashboard.conf.j2 diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 00000000..7be64386 --- /dev/null +++ b/CONTRIBUTING.rst @@ -0,0 +1,85 @@ +OpenStack horizon +################# +:tags: openstack, horizon, cloud, ansible +:category: \*nix + +contributor guidelines +^^^^^^^^^^^^^^^^^^^^^^ + +Filing Bugs +----------- + +Bugs should be filed on Launchpad, not GitHub: "https://bugs.launchpad.net/openstack-ansible" + + +When submitting a bug, or working on a bug, please ensure the following criteria are met: + * The description clearly states or describes the original problem or root cause of the problem. + * Include historical information on how the problem was identified. + * Any relevant logs are included. + * The provided information should be totally self-contained. External access to web services/sites should not be needed. + * Steps to reproduce the problem if possible. + + +Submitting Code +--------------- + +Changes to the project should be submitted for review via the Gerrit tool, following +the workflow documented at: "http://docs.openstack.org/infra/manual/developers.html#development-workflow" + +Pull requests submitted through GitHub will be ignored and closed without regard. + + +Extra +----- + +Tags: + If it's a bug that needs fixing in a branch in addition to Master, add a '\-backport-potential' tag (eg ``juno-backport-potential``). There are predefined tags that will autocomplete. + +Status: + Please leave this alone, it should be New till someone triages the issue. + +Importance: + Should only be touched if it is a Blocker/Gating issue. If it is, please set to High, and only use Critical if you have found a bug that can take down whole infrastructures. + + +Style guide +----------- + +When creating tasks and other roles for use in Ansible please create then using the YAML dictionary format. + +Example YAML dictionary format: + .. code-block:: yaml + + - name: The name of the tasks + module_name: + thing1: "some-stuff" + thing2: "some-other-stuff" + tags: + - some-tag + - some-other-tag + + +Example **NOT** in YAML dictionary format: + .. code-block:: yaml + + - name: The name of the tasks + module_name: thing1="some-stuff" thing2="some-other-stuff" + tags: + - some-tag + - some-other-tag + + +Usage of the ">" and "|" operators should be limited to Ansible conditionals and command modules such as the ansible ``shell`` module. + + +Issues +------ + +When submitting an issue, or working on an issue please ensure the following criteria are met: + * The description clearly states or describes the original problem or root cause of the problem. + * Include historical information on how the problem was identified. + * Any relevant logs are included. + * If the issue is a bug that needs fixing in a branch other than Master, add the ‘backport potential’ tag TO THE ISSUE (not the PR). + * The provided information should be totally self-contained. External access to web services/sites should not be needed. + * If the issue is needed for a hotfix release, add the 'expedite' label. + * Steps to reproduce the problem if possible. diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..e06d2081 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + 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. + diff --git a/README.rst b/README.rst new file mode 100644 index 00000000..54ea7770 --- /dev/null +++ b/README.rst @@ -0,0 +1,19 @@ +OpenStack horizon +############## +:tags: openstack, horizon, cloud, ansible +:category: \*nix + +Role for deployment, setup and installation of horizon. + +This role will install the following: + * horizon-dashboard + +.. code-block:: yaml + + - name: Installation and setup of horizon + hosts: horizon_all + user: root + roles: + - { role: "os_horizon", tags: [ "os-horizon" ] } + vars: + galera_address: "{{ internal_lb_vip_address }}" diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 00000000..a5149822 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,83 @@ +--- +# 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. + +# Defines that the role will be deployed on a host machine +is_metal: true + +## Verbosity Options +debug: False +verbose: True + +## System info +horizon_system_user_name: horizon +horizon_system_group_name: www-data +horizon_system_shell: /bin/false +horizon_system_comment: horizon system user +horizon_system_user_home: "/var/lib/{{ horizon_system_user_name }}" + +## Service Type and Data +horizon_service_region: RegionOne +horizon_service_name: horizon + +## DB info +horizon_galera_database: dash +horizon_galera_user: dash + + +## Horizon Help URL Path +horizon_help_url: http://docs.openstack.org + +## Installation directories +horizon_lib_dir: /usr/local/lib/python2.7/dist-packages + +horizon_endpoint_type: internalURL + +horizon_fqdn: "{{ external_vip_address }}" +horizon_server_name: "horizon" +horizon_log_level: info +horizon_self_signed: true +horizon_self_signed_regen: false +horizon_time_zone: UTC + +## Horizon SSL +### Set the cacert pem if you'd like horizon to verify it. +# horizon_cacert_pem: /path/to/cacert.pem +horizon_ssl_cert: /etc/ssl/certs/apache.cert +horizon_ssl_key: /etc/ssl/private/apache.key +horizon_ssl_cert_path: /etc/ssl/certs + +horizon_listen_ports: + - "80" + - "443" + +horizon_apt_packages: + - apache2 + - apache2-utils + - libapache2-mod-wsgi + - libssl-dev + - libxslt1.1 + - openssl + +horizon_pip_packages: + - django-appconf + - greenlet + - horizon + - keystonemiddleware + - MySQL-python + - oslo.config + - ply + - pycrypto + - python-memcached + - python-keystoneclient diff --git a/files/horizon-manage.py b/files/horizon-manage.py new file mode 100644 index 00000000..5818a6de --- /dev/null +++ b/files/horizon-manage.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +# 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 +import sys + +from django.core.management import execute_from_command_line # noqa + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", + "openstack_dashboard.settings") + execute_from_command_line(sys.argv) diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 00000000..5ee6a4f4 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,19 @@ +--- +# 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. + +- name: Restart apache2 + service: + name: "apache2" + state: "restarted" \ No newline at end of file diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 00000000..51866b1e --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,35 @@ +--- +# 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. + +galaxy_info: + author: rcbops + description: Installation and setup of horizon + company: Rackspace + license: Apache2 + min_ansible_version: 1.6.6 + platforms: + - name: Ubuntu + versions: + - trusty + categories: + - cloud + - python + - horizon + - development + - openstack +dependencies: + - galera_client + - openstack_openrc + - pip_lock_down diff --git a/tasks/horizon_apache.yml b/tasks/horizon_apache.yml new file mode 100644 index 00000000..a9a331d4 --- /dev/null +++ b/tasks/horizon_apache.yml @@ -0,0 +1,65 @@ +--- +# 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. + +- name: Drop apache2 configs + template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: "{{ item.owner|default(horizon_system_user_name) }}" + group: "{{ item.group|default(horizon_system_group_name) }}" + with_items: + - { src: "horizon_apache_ports.conf.j2", dest: "/etc/apache2/ports.conf", owner: "root", group: "root" } + - { src: "openstack_dashboard.conf.j2", dest: "/etc/apache2/sites-available/openstack-dashboard.conf" } + notify: Restart apache2 + tags: + - horizon-apache-config + - horizon-apache-ports + - horizon-apache-vhost + +- name: Enable Horizon Site + file: + src: "/etc/apache2/sites-available/{{ item.name }}" + dest: "/etc/apache2/sites-enabled/{{ item.name }}" + state: "{{ item.state }}" + with_items: + - { state: link, name: openstack-dashboard.conf } + - { state: absent, name: 000-default.conf } + notify: Restart apache2 + tags: + - horizon-apache-config + - horizon-apache-sites-enabled + +- name: Enable apache2 modules + apache2_module: + state: "{{ item.state }}" + name: "{{ item.name }}" + with_items: + - { state: present, name: wsgi } + - { state: present, name: ssl } + - { state: absent, name: mpm_event } + - { state: present, name: mpm_worker } + - { state: present, name: rewrite } + notify: Restart apache2 + tags: + - horizon-apache-config + - horizon-apache-modules + +- name: Ensure Apache ServerName + lineinfile: + dest: "/etc/apache2/apache2.conf" + line: "ServerName {{ horizon_server_name }}" + notify: Restart apache2 + tags: + - horizon-apache-config diff --git a/tasks/horizon_db_setup.yml b/tasks/horizon_db_setup.yml new file mode 100644 index 00000000..9d9f1492 --- /dev/null +++ b/tasks/horizon_db_setup.yml @@ -0,0 +1,48 @@ +--- +# 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. + +- name: Create DB for service + mysql_db: + login_user: "{{ galera_root_user }}" + login_password: "{{ galera_root_password }}" + login_host: "{{ galera_address }}" + name: "{{ horizon_galera_database }}" + state: "present" + tags: + - horizon-db-setup + +- name: Grant access to the DB for the service + mysql_user: + login_user: "{{ galera_root_user }}" + login_password: "{{ galera_root_password }}" + login_host: "{{ galera_address }}" + name: "{{ horizon_galera_user }}" + password: "{{ horizon_container_mysql_password }}" + host: "{{ item }}" + state: "present" + priv: "{{ horizon_galera_database }}.*:ALL" + with_items: + - "localhost" + - "%" + tags: + - horizon-db-setup + +- name: Perform a horizon DB sync + command: horizon-manage.py syncdb --noinput + sudo: yes + sudo_user: "{{ horizon_system_user_name }}" + tags: + - horizon-db-sync + - horizon-setup diff --git a/tasks/horizon_install.yml b/tasks/horizon_install.yml new file mode 100644 index 00000000..e760d565 --- /dev/null +++ b/tasks/horizon_install.yml @@ -0,0 +1,43 @@ +--- +# 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. + +- name: Install apt packages + apt: + pkg: "{{ item }}" + state: latest + update_cache: yes + cache_valid_time: 600 + register: install_packages + until: install_packages|success + retries: 5 + delay: 2 + with_items: horizon_apt_packages + tags: + - horizon-install + - horizon-apt-packages + +- name: Install pip packages + pip: + name: "{{ item }}" + state: present + register: install_packages + until: install_packages|success + retries: 5 + delay: 2 + with_items: + - "{{ horizon_pip_packages }}" + tags: + - horizon-install + - horizon-pip-packages diff --git a/tasks/horizon_post_install.yml b/tasks/horizon_post_install.yml new file mode 100644 index 00000000..8cdb2f9e --- /dev/null +++ b/tasks/horizon_post_install.yml @@ -0,0 +1,61 @@ +--- +# 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. + +- name: Setup Horizon config(s) + template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: "{{ horizon_system_user_name }}" + group: "{{ horizon_system_group_name }}" + mode: "{{ item.mode }}" + with_items: + - { src: "horizon_local_settings.py.j2", dest: "/etc/horizon/local_settings.py", mode: "0644" } + tags: + - horizon-configs + +- name: Setup Horizon config(s) + copy: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: "{{ horizon_system_user_name }}" + group: "{{ horizon_system_group_name }}" + mode: "{{ item.mode }}" + with_items: + - { src: "horizon-manage.py", dest: "/usr/local/bin/horizon-manage.py", mode: "0755" } + tags: + - horizon-configs + +- name: Create horizon links + file: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: "{{ horizon_system_user_name }}" + group: "{{ horizon_system_group_name }}" + state: "link" + with_items: + - { src: "/etc/horizon/local_settings.py", dest: "{{ horizon_lib_dir }}/openstack_dashboard/local/local_settings.py" } + tags: + - horizon-configs + +- name: Collect and compress static files + command: "{{ item }}" + sudo: yes + sudo_user: "{{ horizon_system_user_name }}" + with_items: + - horizon-manage.py collectstatic --noinput + - horizon-manage.py compress --force + tags: + - horizon-configs + - horizon-static-collect diff --git a/tasks/horizon_pre_install.yml b/tasks/horizon_pre_install.yml new file mode 100644 index 00000000..f06d01ec --- /dev/null +++ b/tasks/horizon_pre_install.yml @@ -0,0 +1,77 @@ +--- +# 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. + +- name: create the system group + group: + name: "{{ horizon_system_group_name }}" + state: "present" + system: "yes" + tags: + - horizon-group + +- name: Create the horizon system user + user: + name: "{{ horizon_system_user_name }}" + group: "{{ horizon_system_group_name }}" + comment: "{{ horizon_system_comment }}" + shell: "{{ horizon_system_shell }}" + system: "yes" + createhome: "yes" + home: "{{ horizon_system_user_home }}" + tags: + - horizon-user + +- name: Create horizon dir + file: + path: "{{ item.path }}" + state: directory + owner: "{{ item.owner|default(horizon_system_user_name) }}" + group: "{{ item.group|default(horizon_system_group_name) }}" + with_items: + - { path: "/etc/horizon" } + - { path: "{{ horizon_system_user_home }}" } + - { path: "/usr/local/lib/python2.7/dist-packages/static" } + - { path: "/usr/local/lib/python2.7/dist-packages/openstack_dashboard/local" } + tags: + - horizon-dirs + +- name: Test for log directory or link + shell: | + if [ -h "/var/log/horizon" ]; then + chown -h {{ horizon_system_user_name }}:{{ horizon_system_group_name }} "/var/log/horizon" + chown -R {{ horizon_system_user_name }}:{{ horizon_system_group_name }} "$(readlink /var/log/horizon)" + else + exit 1 + fi + register: log_dir + failed_when: false + changed_when: log_dir.rc != 0 + tags: + - horizon-dirs + - horizon-logs + +- name: Create horizon log dir + file: + path: "{{ item.path }}" + state: directory + owner: "{{ item.owner|default(horizon_system_user_name) }}" + group: "{{ item.group|default(horizon_system_group_name) }}" + mode: "{{ item.mode|default('0755') }}" + with_items: + - { path: "/var/log/horizon" } + when: log_dir.rc != 0 + tags: + - horizon-dirs + - horizon-logs diff --git a/tasks/horizon_ssl_key_create.yml b/tasks/horizon_ssl_key_create.yml new file mode 100644 index 00000000..c2358609 --- /dev/null +++ b/tasks/horizon_ssl_key_create.yml @@ -0,0 +1,39 @@ +--- +# 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. + +- name: Remove self signed cert for regen + file: + dest: "{{ horizon_ssl_cert }}" + state: "absent" + when: > + horizon_self_signed_regen == true or + horizon_self_signed_regen == "True" + +- name: Create self-signed ssl cert + command: > + openssl req -new -nodes -x509 -subj + "/C=US/ST=Texas/L=San Antonio/O=IT/CN={{ horizon_server_name }}" + -days 3650 + -keyout {{ horizon_ssl_key }} + -out {{ horizon_ssl_cert }} + -extensions v3_ca + creates={{ horizon_ssl_cert }} + when: > + horizon_self_signed == true or + horizon_self_signed == "True" + notify: Restart apache2 + tags: + - horizon-apache-self-ssl + - horizon-ssl diff --git a/tasks/horizon_ssl_key_distribute.yml b/tasks/horizon_ssl_key_distribute.yml new file mode 100644 index 00000000..ba151a7c --- /dev/null +++ b/tasks/horizon_ssl_key_distribute.yml @@ -0,0 +1,36 @@ +--- +# 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. + +- name: Distribute self signed ssl + memcached: + name: "{{ item.name }}" + file_path: "{{ item.src }}" + state: "retrieve" + file_mode: "{{ item.file_mode }}" + dir_mode: "{{ item.dir_mode }}" + server: "{{ memcached_servers }}" + encrypt_string: "{{ memcached_encryption_key }}" + with_items: + - { src: "{{ horizon_ssl_cert }}", name: "apache_cert", file_mode: "0640", dir_mode: "0750" } + - { src: "{{ horizon_ssl_key }}", name: "apache_key", file_mode: "0640", dir_mode: "0750" } + register: memcache_keys + until: memcache_keys|success + retries: 5 + delay: 2 + notify: Restart apache2 + tags: + - horizon-key + - horizon-key-distribute + - horizon-ssl diff --git a/tasks/horizon_ssl_key_store.yml b/tasks/horizon_ssl_key_store.yml new file mode 100644 index 00000000..bbf8a612 --- /dev/null +++ b/tasks/horizon_ssl_key_store.yml @@ -0,0 +1,33 @@ +--- +# 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. + +- name: Store self signed ssl + memcached: + name: "{{ item.name }}" + file_path: "{{ item.src }}" + state: "present" + server: "{{ memcached_servers }}" + encrypt_string: "{{ memcached_encryption_key }}" + with_items: + - { src: "{{ horizon_ssl_cert }}", name: "apache_cert" } + - { src: "{{ horizon_ssl_key }}", name: "apache_key" } + register: memcache_keys + until: memcache_keys|success + retries: 5 + delay: 2 + tags: + - horizon-key + - horizon-key-store + - horizon-ssl diff --git a/tasks/horizon_ssl_self_signed.yml b/tasks/horizon_ssl_self_signed.yml new file mode 100644 index 00000000..d3554b77 --- /dev/null +++ b/tasks/horizon_ssl_self_signed.yml @@ -0,0 +1,26 @@ +--- +# 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. + +- include: horizon_ssl_key_create.yml + when: > + inventory_hostname == groups['horizon_all'][0] + +- include: horizon_ssl_key_store.yml + when: > + inventory_hostname == groups['horizon_all'][0] + +- include: horizon_ssl_key_distribute.yml + when: > + inventory_hostname != groups['horizon_all'][0] diff --git a/tasks/horizon_ssl_user_provided.yml b/tasks/horizon_ssl_user_provided.yml new file mode 100644 index 00000000..e723abdc --- /dev/null +++ b/tasks/horizon_ssl_user_provided.yml @@ -0,0 +1,29 @@ +--- +# 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. + +- name: Drop user provided ssl cert + copy: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: "root" + group: "root" + mode: "{{ item.mode }}" + with_items: + - { src: "/etc/ssl/certs/apache.cert", name: "apache.cert", mode: "0640" } + - { src: "/etc/ssl/private/apache.key", name: "apache.key", mode: "0640" } + notify: Restart apache2 + tags: + - horizon-configs + - horizon-ssl diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 00000000..4de972d1 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,37 @@ +--- +# 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. + +- include: horizon_pre_install.yml +- include: horizon_install.yml +- include: horizon_post_install.yml + +- include: horizon_db_setup.yml + when: > + inventory_hostname == groups['horizon_all'][0] + +- include: horizon_ssl_self_signed.yml + when: > + horizon_self_signed == true or + horizon_self_signed == "True" + +- include: horizon_ssl_user_provided.yml + when: > + horizon_self_signed == false or + horizon_self_signed == "False" + +- include: horizon_apache.yml + +- name: Flush handlers + meta: flush_handlers diff --git a/templates/horizon_apache_ports.conf.j2 b/templates/horizon_apache_ports.conf.j2 new file mode 100644 index 00000000..442d248c --- /dev/null +++ b/templates/horizon_apache_ports.conf.j2 @@ -0,0 +1,5 @@ +# {{ ansible_managed }} + +{% for horizon_listen_port in horizon_listen_ports %} +Listen {{ horizon_listen_port }} +{% endfor %} diff --git a/templates/horizon_local_settings.py.j2 b/templates/horizon_local_settings.py.j2 new file mode 100644 index 00000000..54192db9 --- /dev/null +++ b/templates/horizon_local_settings.py.j2 @@ -0,0 +1,533 @@ +import os +from django.utils.translation import ugettext_lazy as _ +from openstack_dashboard import exceptions + +DEBUG = {{ debug }} +TEMPLATE_DEBUG = DEBUG +COMPRESS_ENABLED = True +COMPRESS_ROOT = '{{ horizon_lib_dir }}/static' + +# Required for Django 1.5. +# If horizon is running in production (DEBUG is False), set this +# with the list of host/domain names that the application can serve. +# For more information see: +# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts +ALLOWED_HOSTS = ['*'] + +# Set SSL proxy settings: +# For Django 1.4+ pass this header from the proxy after terminating the SSL, +# and don't forget to strip it from the client's request. +# For more information see: +# https://docs.djangoproject.com/en/1.4/ref/settings/#secure-proxy-ssl-header +# SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL', 'https') + +# If Horizon is being served through SSL, then uncomment the following two +# settings to better secure the cookies from security exploits +CSRF_COOKIE_SECURE = True +SESSION_COOKIE_SECURE = True + +# Overrides for OpenStack API versions. Use this setting to force the +# OpenStack dashboard to use a specific API version for a given service API. +# NOTE: The version should be formatted as it appears in the URL for the +# service API. For example, The identity service APIs have inconsistent +# use of the decimal point, so valid options would be "2.0" or "3". +# OPENSTACK_API_VERSIONS = { +# "data_processing": 1.1, +# "identity": 3, +# "volume": 2 +# } + +# Set this to True if running on multi-domain model. When this is enabled, it +# will require user to enter the Domain name in addition to username for login. +# OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = False + +# Overrides the default domain used when running on single-domain model +# with Keystone V3. All entities will be created in the default domain. +# OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = 'Default' + +# Set Console type: +# valid options would be "AUTO"(default), "VNC", "SPICE", "RDP" or None +# Set to None explicitly if you want to deactivate the console. +# CONSOLE_TYPE = "AUTO" + +# Default OpenStack Dashboard configuration. +HORIZON_CONFIG = { + 'dashboards': ('project', 'admin', 'settings',), + 'default_dashboard': 'project', + 'user_home': 'openstack_dashboard.views.get_user_home', + 'ajax_queue_limit': 10, + 'auto_fade_alerts': { + 'delay': 3000, + 'fade_duration': 1500, + 'types': ['alert-success', 'alert-info'] + }, + 'help_url': "{{ horizon_help_url|default('http://docs.openstack.org') }}", + 'exceptions': {'recoverable': exceptions.RECOVERABLE, + 'not_found': exceptions.NOT_FOUND, + 'unauthorized': exceptions.UNAUTHORIZED}, + 'angular_modules': [], + 'js_files': [], +} + +# Specify a regular expression to validate user passwords. +# HORIZON_CONFIG["password_validator"] = { +# "regex": '.*', +# "help_text": _("Your password does not meet the requirements.") +# } + +# Disable simplified floating IP address management for deployments with +# multiple floating IP pools or complex network requirements. +# HORIZON_CONFIG["simple_ip_management"] = False + +# Turn off browser autocompletion for forms including the login form and +# the database creation workflow if so desired. +# HORIZON_CONFIG["password_autocomplete"] = "off" + +LOCAL_PATH = os.path.dirname(os.path.abspath(__file__)) + +# Set custom secret key: +# You can either set it to a specific value or you can let horizon generate a +# default secret key that is unique on this machine, e.i. regardless of the +# amount of Python WSGI workers (if used behind Apache+mod_wsgi): However, there +# may be situations where you would want to set this explicitly, e.g. when +# multiple dashboard instances are distributed on different machines (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. +{% if horizon_secret_key %} +SECRET_KEY = "{{ horizon_secret_key }}" +{% else %} +from horizon.utils import secret_key +SECRET_KEY = secret_key.generate_or_read_from_file('/var/lib/horizon/.secret_key_store') +{% endif %} + +# 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': {{ memcached_servers.split(',') }} + } +} + +SESSION_ENGINE = "django.contrib.sessions.backends.cached_db" + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'HOST': '{{ galera_address }}', + 'NAME': '{{ horizon_galera_database }}', + 'USER': '{{ horizon_galera_user }}', + 'PASSWORD': '{{ horizon_container_mysql_password }}', + 'default-character-set': 'utf8' + }, +} + +# Send email to the console by default +EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' +# Or send them to /dev/null +#EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend' + +# Configure these for your outgoing email host +# EMAIL_HOST = 'smtp.my-company.com' +# EMAIL_PORT = 25 +# EMAIL_HOST_USER = 'djangomail' +# EMAIL_HOST_PASSWORD = 'top-secret!' + +# For multiple regions uncomment this configuration, and add (endpoint, title). +# AVAILABLE_REGIONS = [ +# ('http://cluster1.example.com:5000/v2.0', 'cluster1'), +# ('http://cluster2.example.com:5000/v2.0', 'cluster2'), +# ] + +OPENSTACK_HOST = "{{ internal_lb_vip_address }}" +OPENSTACK_KEYSTONE_URL = "{{ keystone_service_internalurl }}" +OPENSTACK_KEYSTONE_DEFAULT_ROLE = "_member_" + +# Disable SSL certificate checks (useful for self-signed certificates): +{% if horizon_self_signed == true %} +OPENSTACK_SSL_NO_VERIFY = True +{% else %} +OPENSTACK_SSL_NO_VERIFY = False +{% endif %} + +{% if horizon_cacert_pem is defined %} +# The CA certificate to use to verify SSL connections +OPENSTACK_SSL_CACERT = "{{ horizon_cacert_pem }}" +{% endif %} + +# The OPENSTACK_KEYSTONE_BACKEND settings can be used to identify the +# capabilities of the auth backend for Keystone. +# If Keystone has been configured to use LDAP as the auth backend then set +# can_edit_user to False and name to 'ldap'. +# +# TODO(tres): Remove these once Keystone has an API to identify auth backend. +OPENSTACK_KEYSTONE_BACKEND = { + 'name': 'native', + 'can_edit_user': True, + 'can_edit_group': True, + 'can_edit_project': True, + 'can_edit_domain': True, + 'can_edit_role': True +} + +#Setting this to True, will add a new "Retrieve Password" action on instance, +#allowing Admin session password retrieval/decryption. +#OPENSTACK_ENABLE_PASSWORD_RETRIEVE = False + +# The Xen Hypervisor has the ability to set the mount point for volumes +# attached to instances (other Hypervisors currently do not). Setting +# can_set_mount_point to True will add the option to set the mount point +# from the UI. +OPENSTACK_HYPERVISOR_FEATURES = { + 'can_set_mount_point': False, + 'can_set_password': False, +} + +# The OPENSTACK_CINDER_FEATURES settings can be used to enable optional +# services provided by cinder that is not exposed by its extension API. +OPENSTACK_CINDER_FEATURES = { + 'enable_backup': False, +} + +# The OPENSTACK_NEUTRON_NETWORK settings can be used to enable optional +# services provided by neutron. Options currently available are load +# balancer service, security groups, quotas, VPN service. +OPENSTACK_NEUTRON_NETWORK = { + 'enable_router': True, + 'enable_quotas': True, + 'enable_ipv6': False, + 'enable_distributed_router': False, + 'enable_ha_router': False, + 'enable_lb': False, + 'enable_firewall': False, + 'enable_vpn': False, + # The profile_support option is used to detect if an external router can be + # configured via the dashboard. When using specific plugins the + # profile_support can be turned on if needed. + 'profile_support': None, + #'profile_support': 'cisco', + # Set which provider network types are supported. Only the network types + # in this list will be available to choose from when creating a network. + # Network types include local, flat, vlan, gre, and vxlan. + 'supported_provider_types': ['flat', 'vlan', 'vxlan'], +} + +# The OPENSTACK_IMAGE_BACKEND settings can be used to customize features +# in the OpenStack Dashboard related to the Image service, such as the list +# of supported image formats. +OPENSTACK_IMAGE_BACKEND = { + 'image_formats': [ + ('', ''), + ('aki', _('AKI - Amazon Kernel Image')), + ('ami', _('AMI - Amazon Machine Image')), + ('ari', _('ARI - Amazon Ramdisk Image')), + ('iso', _('ISO - Optical Disk Image')), + ('qcow2', _('QCOW2 - QEMU Emulator')), + ('raw', _('Raw')), + ('vdi', _('VDI')), + ('vhd', _('VHD')), + ('vmdk', _('VMDK')) + ] +} + +# The IMAGE_CUSTOM_PROPERTY_TITLES settings is used to customize the titles for +# image custom property attributes that appear on image detail pages. +IMAGE_CUSTOM_PROPERTY_TITLES = { + "architecture": _("Architecture"), + "kernel_id": _("Kernel ID"), + "ramdisk_id": _("Ramdisk ID"), + "image_state": _("Euca2ools state"), + "project_id": _("Project ID"), + "image_type": _("Image Type") +} + +# The IMAGE_RESERVED_CUSTOM_PROPERTIES setting is used to specify which image +# custom properties should not be displayed in the Image Custom Properties +# table. +IMAGE_RESERVED_CUSTOM_PROPERTIES = [] + +# OPENSTACK_ENDPOINT_TYPE specifies the endpoint type to use for the endpoints +# in the Keystone service catalog. Use this setting when Horizon is running +# external to the OpenStack environment. The default is 'publicURL'. +OPENSTACK_ENDPOINT_TYPE = '{{ horizon_endpoint_type }}' + +# SECONDARY_ENDPOINT_TYPE specifies the fallback endpoint type to use in the +# case that OPENSTACK_ENDPOINT_TYPE is not present in the endpoints +# in the Keystone service catalog. Use this setting when Horizon is running +# external to the OpenStack environment. The default is None. This +# value should differ from OPENSTACK_ENDPOINT_TYPE if used. +#SECONDARY_ENDPOINT_TYPE = "publicURL" + +# The number of objects (Swift containers/objects or images) to display +# on a single page before providing a paging element (a "more" link) +# to paginate results. +API_RESULT_LIMIT = 1000 +API_RESULT_PAGE_SIZE = 20 + +# The timezone of the server. This should correspond with the timezone +# of your entire OpenStack installation, and hopefully be in UTC. +TIME_ZONE = "{{ horizon_time_zone }}" + +# When launching an instance, the menu of available flavors is +# sorted by RAM usage, ascending. If you would like a different sort order, +# you can provide another flavor attribute as sorting key. Alternatively, you +# can provide a custom callback method to use for sorting. You can also provide +# a flag for reverse sort. For more info, see +# http://docs.python.org/2/library/functions.html#sorted +# CREATE_INSTANCE_FLAVOR_SORT = { +# 'key': 'name', +# # or +# 'key': my_awesome_callback_method, +# 'reverse': False, +# } + +# The Horizon Policy Enforcement engine uses these values to load per service +# policy rule files. The content of these files should match the files the +# OpenStack services are using to determine role based access control in the +# target installation. + +# Path to directory containing policy.json files +#POLICY_FILES_PATH = os.path.join(ROOT_PATH, "conf") +# Map of local copy of service policy files +#POLICY_FILES = { +# 'identity': 'keystone_policy.json', +# 'compute': 'nova_policy.json', +# 'volume': 'cinder_policy.json', +# 'image': 'glance_policy.json', +# 'orchestration': 'heat_policy.json', +# 'network': 'neutron_policy.json', +#} + +# Trove user and database extension support. By default support for +# creating users and databases on database instances is turned on. +# To disable these extensions set the permission here to something +# unusable such as ["!"]. +# TROVE_ADD_USER_PERMS = [] +# TROVE_ADD_DATABASE_PERMS = [] + +LOGGING = { + 'version': 1, + # When set to True this will disable all logging except + # for loggers specified in this configuration dictionary. Note that + # if nothing is specified here and disable_existing_loggers is True, + # django.db.backends will still log unless it is disabled explicitly. + 'disable_existing_loggers': False, + 'handlers': { + 'null': { + 'level': 'DEBUG', + 'class': 'django.utils.log.NullHandler', + }, + 'console': { + # Set the level to "DEBUG" for verbose output logging. + 'level': 'INFO', + 'class': 'logging.StreamHandler', + }, + }, + 'loggers': { + # Logging from django.db.backends is VERY verbose, send to null + # by default. + 'django.db.backends': { + 'handlers': ['null'], + 'propagate': False, + }, + 'requests': { + 'handlers': ['null'], + 'propagate': False, + }, + 'horizon': { + 'handlers': ['console'], + 'level': 'DEBUG', + 'propagate': False, + }, + 'openstack_dashboard': { + 'handlers': ['console'], + 'level': 'DEBUG', + 'propagate': False, + }, + 'novaclient': { + 'handlers': ['console'], + 'level': 'DEBUG', + 'propagate': False, + }, + 'cinderclient': { + 'handlers': ['console'], + 'level': 'DEBUG', + 'propagate': False, + }, + 'keystoneclient': { + 'handlers': ['console'], + 'level': 'DEBUG', + 'propagate': False, + }, + 'glanceclient': { + 'handlers': ['console'], + 'level': 'DEBUG', + 'propagate': False, + }, + 'neutronclient': { + 'handlers': ['console'], + 'level': 'DEBUG', + 'propagate': False, + }, + 'heatclient': { + 'handlers': ['console'], + 'level': 'DEBUG', + 'propagate': False, + }, + 'ceilometerclient': { + 'handlers': ['console'], + 'level': 'DEBUG', + 'propagate': False, + }, + 'troveclient': { + 'handlers': ['console'], + 'level': 'DEBUG', + 'propagate': False, + }, + 'swiftclient': { + 'handlers': ['console'], + 'level': 'DEBUG', + 'propagate': False, + }, + 'openstack_auth': { + 'handlers': ['console'], + 'level': 'DEBUG', + 'propagate': False, + }, + 'nose.plugins.manager': { + 'handlers': ['console'], + 'level': 'DEBUG', + 'propagate': False, + }, + 'django': { + 'handlers': ['console'], + 'level': 'DEBUG', + 'propagate': False, + }, + 'iso8601': { + 'handlers': ['null'], + 'propagate': False, + }, + 'scss': { + 'handlers': ['null'], + 'propagate': False, + }, + } +} + +# 'direction' should not be specified for all_tcp/udp/icmp. +# It is specified in the form. +SECURITY_GROUP_RULES = { + 'all_tcp': { + 'name': _('All TCP'), + 'ip_protocol': 'tcp', + 'from_port': '1', + 'to_port': '65535', + }, + 'all_udp': { + 'name': _('All UDP'), + 'ip_protocol': 'udp', + 'from_port': '1', + 'to_port': '65535', + }, + 'all_icmp': { + 'name': _('All ICMP'), + 'ip_protocol': 'icmp', + 'from_port': '-1', + 'to_port': '-1', + }, + 'ssh': { + 'name': 'SSH', + 'ip_protocol': 'tcp', + 'from_port': '22', + 'to_port': '22', + }, + 'smtp': { + 'name': 'SMTP', + 'ip_protocol': 'tcp', + 'from_port': '25', + 'to_port': '25', + }, + 'dns': { + 'name': 'DNS', + 'ip_protocol': 'tcp', + 'from_port': '53', + 'to_port': '53', + }, + 'http': { + 'name': 'HTTP', + 'ip_protocol': 'tcp', + 'from_port': '80', + 'to_port': '80', + }, + 'pop3': { + 'name': 'POP3', + 'ip_protocol': 'tcp', + 'from_port': '110', + 'to_port': '110', + }, + 'imap': { + 'name': 'IMAP', + 'ip_protocol': 'tcp', + 'from_port': '143', + 'to_port': '143', + }, + 'ldap': { + 'name': 'LDAP', + 'ip_protocol': 'tcp', + 'from_port': '389', + 'to_port': '389', + }, + 'https': { + 'name': 'HTTPS', + 'ip_protocol': 'tcp', + 'from_port': '443', + 'to_port': '443', + }, + 'smtps': { + 'name': 'SMTPS', + 'ip_protocol': 'tcp', + 'from_port': '465', + 'to_port': '465', + }, + 'imaps': { + 'name': 'IMAPS', + 'ip_protocol': 'tcp', + 'from_port': '993', + 'to_port': '993', + }, + 'pop3s': { + 'name': 'POP3S', + 'ip_protocol': 'tcp', + 'from_port': '995', + 'to_port': '995', + }, + 'ms_sql': { + 'name': 'MS SQL', + 'ip_protocol': 'tcp', + 'from_port': '1433', + 'to_port': '1433', + }, + 'mysql': { + 'name': 'MYSQL', + 'ip_protocol': 'tcp', + 'from_port': '3306', + 'to_port': '3306', + }, + 'rdp': { + 'name': 'RDP', + 'ip_protocol': 'tcp', + 'from_port': '3389', + 'to_port': '3389', + }, +} + +# Indicate to the Sahara data processing service whether or not +# automatic floating IP allocation is in effect. If it is not +# in effect, the user will be prompted to choose a floating IP +# pool for use in their cluster. False by default. You would want +# to set this to True if you were running Nova Networking with +# auto_assign_floating_ip = True. +# SAHARA_AUTO_IP_ALLOCATION_ENABLED = False diff --git a/templates/openstack_dashboard.conf.j2 b/templates/openstack_dashboard.conf.j2 new file mode 100644 index 00000000..6cb81879 --- /dev/null +++ b/templates/openstack_dashboard.conf.j2 @@ -0,0 +1,49 @@ +# {{ ansible_managed }} + +{% set threads = ansible_processor_vcpus // 2 %} + + + ServerName {{ horizon_server_name }} + RewriteEngine On + RewriteCond %{HTTPS} !=on + RewriteRule ^/?(.*) https://%{HTTP_HOST}/$1 [R,L] + + + + ServerName {{ horizon_server_name }} + + LogLevel {{ horizon_log_level }} + ErrorLog /var/log/horizon/horizon-error.log + CustomLog /var/log/horizon/ssl_access.log combined + Options +FollowSymLinks + + SSLEngine on + SSLCertificateFile {{ horizon_ssl_cert }} + SSLCertificateKeyFile {{ horizon_ssl_key }} + SSLCACertificatePath {{ horizon_ssl_cert_path }} + SSLCARevocationPath {{ horizon_ssl_cert_path }} + SSLProtocol All -SSLv2 -SSLv3 + SSLHonorCipherOrder On + SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4" + SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown + + WSGIScriptAlias / {{ horizon_lib_dir }}/openstack_dashboard/wsgi/django.wsgi + WSGIDaemonProcess horizon user={{ horizon_system_user_name }} group={{ horizon_system_group_name }} processes={{ ansible_processor_cores }} threads={{ threads if threads > 0 else 1 }} + + Alias /static {{ horizon_lib_dir }}/static/ + + + Order allow,deny + allow from all + Require all granted + + + + + Options -FollowSymlinks + AllowOverride None + Order allow,deny + allow from all + Require all granted + +