commit 1e6d9b3a4673c4267948e6ae8806256be2713744 Author: Travis Truman Date: Thu Mar 24 17:13:47 2016 -0400 Inital commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..63ae8eb --- /dev/null +++ b/.gitignore @@ -0,0 +1,65 @@ +# Compiled source # +################### +*.com +*.class +*.dll +*.exe +*.o +*.so +*.pyc +build/ +dist/ +doc/build/ + +# Packages # +############ +# it's better to unpack these files and commit the raw source +# git has its own built in compression methods +*.7z +*.dmg +*.gz +*.iso +*.jar +*.rar +*.tar +*.zip + +# Logs and databases # +###################### +*.log +*.sql +*.sqlite + +# OS generated files # +###################### +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +.idea +.tox +*.sublime* +*.egg-info +Icon? +ehthumbs.db +Thumbs.db +.eggs + +# User driven backup files # +############################ +*.bak + +# Generated by pbr while building docs +###################################### +AUTHORS +ChangeLog + +# Files created by releasenotes build +releasenotes/build + +# Test temp files +tests/plugins + +# Vagrant testing artifacts +.vagrant diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..ce2c929 --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=review.openstack.org +port=29418 +project=openstack/openstack-ansible-os_rally.git diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 0000000..02596c2 --- /dev/null +++ b/CONTRIBUTING.rst @@ -0,0 +1,120 @@ +OpenStack-Ansible Rally +####################### +:tags: openstack, rally, 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. + +If you wish to test your changes locally prior to submitting them for review +you can use the ``Vagrantfile`` included in the root of this repository. It +aims to replicate the gate check testing that will be done by OpenStack CI +once your review has been submitted. + +To run tests: + +.. code-block:: shell-session + + # vagrant up + +The Vagrant box will run all tests and report status in the output. If you +need to iterate through a fix/test cycle, tests can be re-run in a running +Vagrant box with: + +.. code-block:: shell-session + + # vagrant provision + + +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 0000000..8dada3e --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + 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 0000000..cc5276f --- /dev/null +++ b/README.rst @@ -0,0 +1,30 @@ +OpenStack-Ansible Rally +####################### +:tags: openstack, rally, cloud, ansible +:category: \*nix + +This Ansible role installs and configures OpenStack Rally. + +Default Variables +================= + +.. literalinclude:: ../../defaults/main.yml + :language: yaml + :start-after: under the License. + +Required Variables +================== + + * rally_galera_address + * rally_galera_password + +Example Playbook +================ + +.. code-block:: yaml + + - name: Install Rally server + hosts: rally_all + user: root + roles: + - role: "os_rally" diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..0c3ef50 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,46 @@ +--- +# Copyright 2016, Comcast Corporation +# +# 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. + +rally_system_group_name: rally +rally_system_user_name: rally +rally_system_user_comment: Rally System User +rally_system_user_shell: /bin/false +rally_system_user_home: "/var/lib/{{ rally_system_user_name }}" +rally_etc_directory: /etc/rally + +rally_git_repo: "https://git.openstack.org/openstack/rally" +rally_git_install_branch: c09af59f0f06db9e74a334aaee4c493119384ea7 # master +rally_git_dest: "/opt/rally_{{ rally_git_install_branch |replace('/', '_') }}" + +# Database vars +rally_galera_database_name: rally_service +rally_galera_user: magnum +rally_database_connection_string: mysql+pymysql://{{ rally_galera_user }}:{{ rally_galera_password }}@{{ rally_galera_address }}/{{ rally_galera_database_name }}?charset=utf8 + +rally_apt_packages: + - build-essential + - libssl-dev + - libffi-dev + - python-dev + - libxml2-dev + - libxslt1-dev + - libpq-dev + - git + - wget + - pymysql + +rally_pip_packages: + - setuptools + - rally \ No newline at end of file diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..f27d52e --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,14 @@ +--- +# Copyright 2016, Comcast Corporation +# +# 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/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..c063eb7 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,16 @@ +galaxy_info: + author: Comcast Corporation + description: Install and configure OpenStack Rally + company: Comcast Corportation + license: Apache2 + min_ansible_version: 1.9 + platforms: + - name: Ubuntu + versions: + - trusty + galaxy_tags: [] +dependencies: + - apt_package_pinning + - galera_client + - pip_install + - pip_lock_down diff --git a/other-requirements.txt b/other-requirements.txt new file mode 100644 index 0000000..11dcac9 --- /dev/null +++ b/other-requirements.txt @@ -0,0 +1,11 @@ +# This file facilitates OpenStack-CI package installation +# before the execution of any tests. +# +# See the following for details: +# - http://docs.openstack.org/infra/bindep/ +# - https://github.com/openstack-infra/bindep +# +# Even if the role does not make use of this facility, it +# is better to have this file empty, otherwise OpenStack-CI +# will fall back to installing its default packages which +# will potentially be detrimental to the tests executed. diff --git a/run_tests.sh b/run_tests.sh new file mode 100644 index 0000000..6a711cf --- /dev/null +++ b/run_tests.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +# Copyright 2015, 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. + +set -euov + +FUNCTIONAL_TEST=${FUNCTIONAL_TEST:-true} + +# prep the host +if [ "$(which apt-get)" ]; then + apt-get install -y build-essential python2.7 python-dev git-core +fi + +# get pip, if necessary +if [ ! "$(which pip)" ]; then + curl --silent --show-error --retry 5 \ + https://bootstrap.pypa.io/get-pip.py | sudo python2.7 +fi + +# install tox +pip install tox + +# run through each tox env and execute the test +for tox_env in $(awk -F= '/envlist/ {print $2}' tox.ini | sed 's/,/ /g'); do + if [ "${tox_env}" != "functional" ]; then + tox -e ${tox_env} + elif [ "${tox_env}" == "functional" ]; then + if ${FUNCTIONAL_TEST}; then + tox -e ${tox_env} + fi + fi +done diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..dc5e35b --- /dev/null +++ b/setup.cfg @@ -0,0 +1,24 @@ +[metadata] +name = openstack-ansible-os_rally +summary = os_rally for OpenStack Ansible +description-file = + README.rst +author = OpenStack +author-email = openstack-dev@lists.openstack.org +home-page = http://www.openstack.org/ +classifier = + Intended Audience :: Developers + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux + +[build_sphinx] +all_files = 1 +build-dir = doc/build +source-dir = doc/source + +[pbr] +warnerrors = True + +[wheel] +universal = 1 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..70c2b3f --- /dev/null +++ b/setup.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. +# +# 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. + +# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT +import setuptools + +setuptools.setup( + setup_requires=['pbr'], + pbr=True) diff --git a/tasks/install.yml b/tasks/install.yml new file mode 100644 index 0000000..a716bed --- /dev/null +++ b/tasks/install.yml @@ -0,0 +1,208 @@ +--- +# Copyright 2016, Comcast Corporation +# +# 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 developer mode constraint file + copy: + dest: "/opt/developer-pip-constraints.txt" + content: | + {% for item in rally_developer_constraints %} + {{ item }} + {% endfor %} + when: + - rally_developer_mode | bool + tags: + - rally-install + - rally-pip-packages + +- name: Clone requirements git repository + git: + repo: "{{ rally_requirements_git_repo }}" + dest: "/opt/requirements" + clone: yes + update: yes + version: "{{ rally_requirements_git_install_branch }}" + when: + - rally_developer_mode | bool + tags: + - rally-install + - rally-pip-packages + +- name: Add constraints to pip_install_options fact for developer mode + set_fact: + pip_install_options_fact: "{{ pip_install_options|default('') }} --constraint /opt/developer-pip-constraints.txt --constraint /opt/requirements/upper-constraints.txt" + when: + - rally_developer_mode | bool + tags: + - rally-install + - rally-pip-packages + +- name: Set pip_install_options_fact when not in developer mode + set_fact: + pip_install_options_fact: "{{ pip_install_options|default('') }}" + when: + - not rally_developer_mode | bool + tags: + - rally-install + - rally-pip-packages + +- name: Install requires pip packages + pip: + name: "{{ item }}" + state: present + extra_args: "{{ pip_install_options_fact }}" + register: install_packages + until: install_packages|success + retries: 5 + delay: 2 + with_items: rally_requires_pip_packages + tags: + - rally-install + - rally-pip-packages + +- name: Get local venv checksum + stat: + path: "/var/cache/{{ rally_venv_download_url | basename }}" + get_md5: False + when: + - not rally_developer_mode | bool + - rally_venv_enabled | bool + register: local_venv_stat + tags: + - rally-install + - rally-pip-packages + +- name: Get remote venv checksum + uri: + url: "{{ rally_venv_download_url | replace('tgz', 'checksum') }}" + return_content: True + when: + - not rally_developer_mode | bool + - rally_venv_enabled | bool + register: remote_venv_checksum + tags: + - rally-install + - rally-pip-packages + +# TODO: When project moves to ansible 2 we can pass this a sha256sum which will: +# a) allow us to remove force: yes +# b) allow the module to calculate the checksum of dest file which would +# result in file being downloaded only if provided and dest sha256sum +# checksums differ +- name: Attempt venv download + get_url: + url: "{{ rally_venv_download_url }}" + dest: "/var/cache/{{ rally_venv_download_url | basename }}" + force: yes + ignore_errors: true + register: get_venv + when: + - not rally_developer_mode | bool + - rally_venv_enabled | bool + - (local_venv_stat.stat.exists == False or + {{ local_venv_stat.stat.checksum is defined and local_venv_stat.stat.checksum != remote_venv_checksum.content | trim }}) + tags: + - rally-install + - rally-pip-packages + +- name: Set rally get_venv fact + set_fact: + rally_get_venv: "{{ get_venv }}" + when: rally_venv_enabled | bool + tags: + - rally-install + - rally-pip-packages + +- name: Remove existing venv + file: + path: "{{ rally_venv_bin | dirname }}" + state: absent + when: + - rally_venv_enabled | bool + - rally_get_venv | changed + tags: + - rally-install + - rally-pip-packages + +- name: Create rally venv dir + file: + path: "{{ rally_venv_bin | dirname }}" + state: directory + when: + - not rally_developer_mode | bool + - rally_venv_enabled | bool + - rally_get_venv | changed + tags: + - rally-install + - rally-pip-packages + +- name: Unarchive pre-built venv + unarchive: + src: "/var/cache/{{ rally_venv_download_url | basename }}" + dest: "{{ rally_venv_bin | dirname }}" + copy: "no" + when: + - not rally_developer_mode | bool + - rally_venv_enabled | bool + - rally_get_venv | changed + tags: + - rally-install + - rally-pip-packages + +- name: Update virtualenv path + command: > + virtualenv-tools --update-path=auto {{ rally_venv_bin | dirname }} + when: + - not rally_developer_mode | bool + - rally_venv_enabled | bool + - rally_get_venv | success + tags: + - rally-install + - rally-pip-packages + +- name: Install pip packages (venv) + pip: + name: "{{ item }}" + state: present + virtualenv: "{{ rally_venv_bin | dirname }}" + virtualenv_site_packages: "no" + extra_args: "{{ pip_install_options_fact }}" + register: install_packages + until: install_packages|success + retries: 5 + delay: 2 + with_items: rally_pip_packages + when: + - rally_venv_enabled | bool + - rally_get_venv | failed or rally_developer_mode | bool + tags: + - rally-install + - rally-pip-packages + +- name: Install pip packages (no venv) + pip: + name: "{{ item }}" + state: present + extra_args: "{{ pip_install_options_fact }}" + register: install_packages + until: install_packages|success + retries: 5 + delay: 2 + with_items: rally_pip_packages + when: + - not rally_venv_enabled | bool + - not rally_developer_mode | bool + tags: + - rally-install + - rally-pip-packages \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..10e7a68 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,24 @@ +--- +# Copyright 2016, Comcast Corporation +# +# 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: pre-install.yml + +- include: install.yml + +- include: post-install.yml + +- include: database-setup.yml + when: + - inventory_hostname == groups['rally_all'][0] \ No newline at end of file diff --git a/tasks/post-install.yml b/tasks/post-install.yml new file mode 100644 index 0000000..08bdce9 --- /dev/null +++ b/tasks/post-install.yml @@ -0,0 +1,15 @@ +--- +# Copyright 2016, Comcast Corporation +# +# 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/tasks/pre-install.yml b/tasks/pre-install.yml new file mode 100644 index 0000000..4ede710 --- /dev/null +++ b/tasks/pre-install.yml @@ -0,0 +1,47 @@ +--- +# Copyright 2016, Comcast Corporation +# +# 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 Rally system group + group: + name: "{{ rally_system_group_name }}" + state: "present" + system: "yes" + tags: + - rally-group + +- name: Create the Rally system user + user: + name: "{{ rally_system_user_name }}" + group: "{{ rally_system_group_name }}" + comment: "{{ rally_system_user_comment }}" + shell: "{{ rally_system_user_shell }}" + system: "yes" + createhome: "yes" + home: "{{ rally_system_user_home }}" + tags: + - rally-user + +- name: Create Rally directories + file: + path: "{{ item.path }}" + state: "directory" + owner: "{{ rally_system_user_name }}" + group: "{{ rally_system_group_name }}" + mode: "0750" + with_items: + - path: "{{ rally_etc_directory }}" + - path: "{{ rally_system_user_home }}" + tags: + - rally-directories diff --git a/templates/rally.conf.j2 b/templates/rally.conf.j2 new file mode 100644 index 0000000..10226ae --- /dev/null +++ b/templates/rally.conf.j2 @@ -0,0 +1,698 @@ +[DEFAULT] + +# +# From oslo.log +# + +# If set to true, the logging level will be set to DEBUG instead of +# the default INFO level. (boolean value) +#debug = false + +# If set to false, the logging level will be set to WARNING instead of +# the default INFO level. (boolean value) +# This option is deprecated for removal. +# Its value may be silently ignored in the future. +#verbose = true + +# The name of a logging configuration file. This file is appended to +# any existing logging configuration files. For details about logging +# configuration files, see the Python logging module documentation. +# Note that when logging configuration files are used then all logging +# configuration is set in the configuration file and other logging +# configuration options are ignored (for example, +# logging_context_format_string). (string value) +# Deprecated group/name - [DEFAULT]/log_config +#log_config_append = + +# Defines the format string for %%(asctime)s in log records. Default: +# %(default)s . This option is ignored if log_config_append is set. +# (string value) +#log_date_format = %Y-%m-%d %H:%M:%S + +# (Optional) Name of log file to send logging output to. If no default +# is set, logging will go to stderr as defined by use_stderr. This +# option is ignored if log_config_append is set. (string value) +# Deprecated group/name - [DEFAULT]/logfile +#log_file = + +# (Optional) The base directory used for relative log_file paths. +# This option is ignored if log_config_append is set. (string value) +# Deprecated group/name - [DEFAULT]/logdir +#log_dir = + +# Uses logging handler designed to watch file system. When log file is +# moved or removed this handler will open a new log file with +# specified path instantaneously. It makes sense only if log_file +# option is specified and Linux platform is used. This option is +# ignored if log_config_append is set. (boolean value) +#watch_log_file = false + +# Use syslog for logging. Existing syslog format is DEPRECATED and +# will be changed later to honor RFC5424. This option is ignored if +# log_config_append is set. (boolean value) +#use_syslog = false + +# Syslog facility to receive log lines. This option is ignored if +# log_config_append is set. (string value) +#syslog_log_facility = LOG_USER + +# Log output to standard error. This option is ignored if +# log_config_append is set. (boolean value) +#use_stderr = true + +# Format string to use for log messages with context. (string value) +#logging_context_format_string = %(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s + +# Format string to use for log messages when context is undefined. +# (string value) +#logging_default_format_string = %(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s + +# Additional data to append to log message when logging level for the +# message is DEBUG. (string value) +#logging_debug_format_suffix = %(funcName)s %(pathname)s:%(lineno)d + +# Prefix each line of exception output with this format. (string +# value) +#logging_exception_prefix = %(asctime)s.%(msecs)03d %(process)d ERROR %(name)s %(instance)s + +# Defines the format string for %(user_identity)s that is used in +# logging_context_format_string. (string value) +#logging_user_identity_format = %(user)s %(tenant)s %(domain)s %(user_domain)s %(project_domain)s + +# List of package logging levels in logger=LEVEL pairs. This option is +# ignored if log_config_append is set. (list value) +#default_log_levels = amqp=WARN,amqplib=WARN,boto=WARN,qpid=WARN,sqlalchemy=WARN,suds=INFO,oslo.messaging=INFO,iso8601=WARN,requests.packages.urllib3.connectionpool=WARN,urllib3.connectionpool=WARN,websocket=WARN,requests.packages.urllib3.util.retry=WARN,urllib3.util.retry=WARN,keystonemiddleware=WARN,routes.middleware=WARN,stevedore=WARN,taskflow=WARN,keystoneauth=WARN,oslo.cache=INFO,dogpile.core.dogpile=INFO + +# Enables or disables publication of error events. (boolean value) +#publish_errors = false + +# The format for an instance that is passed with the log message. +# (string value) +#instance_format = "[instance: %(uuid)s] " + +# The format for an instance UUID that is passed with the log message. +# (string value) +#instance_uuid_format = "[instance: %(uuid)s] " + +# Enables or disables fatal status of deprecations. (boolean value) +#fatal_deprecations = false + +# +# From rally +# + +# Print debugging output only for Rally. Off-site components stay +# quiet. (boolean value) +#rally_debug = false + +# HTTP timeout for any of OpenStack service in seconds (floating point +# value) +#openstack_client_http_timeout = 180.0 + + +[benchmark] + +# +# From rally +# + +# Time to sleep after creating a resource before polling for it status +# (floating point value) +#cinder_volume_create_prepoll_delay = 2.0 + +# Time to wait for cinder volume to be created. (floating point value) +#cinder_volume_create_timeout = 600.0 + +# Interval between checks when waiting for volume creation. (floating +# point value) +#cinder_volume_create_poll_interval = 2.0 + +# Time to wait for cinder volume to be deleted. (floating point value) +#cinder_volume_delete_timeout = 600.0 + +# Interval between checks when waiting for volume deletion. (floating +# point value) +#cinder_volume_delete_poll_interval = 2.0 + +# Time to sleep after boot before polling for status (floating point +# value) +#ec2_server_boot_prepoll_delay = 1.0 + +# Server boot timeout (floating point value) +#ec2_server_boot_timeout = 300.0 + +# Server boot poll interval (floating point value) +#ec2_server_boot_poll_interval = 1.0 + +# Time to sleep after creating a resource before polling for it status +# (floating point value) +#glance_image_create_prepoll_delay = 2.0 + +# Time to wait for glance image to be created. (floating point value) +#glance_image_create_timeout = 120.0 + +# Interval between checks when waiting for image creation. (floating +# point value) +#glance_image_create_poll_interval = 1.0 + +# Time to wait for glance image to be deleted. (floating point value) +#glance_image_delete_timeout = 120.0 + +# Interval between checks when waiting for image deletion. (floating +# point value) +#glance_image_delete_poll_interval = 1.0 + +# Time(in sec) to sleep after creating a resource before polling for +# it status. (floating point value) +#heat_stack_create_prepoll_delay = 2.0 + +# Time(in sec) to wait for heat stack to be created. (floating point +# value) +#heat_stack_create_timeout = 3600.0 + +# Time interval(in sec) between checks when waiting for stack +# creation. (floating point value) +#heat_stack_create_poll_interval = 1.0 + +# Time(in sec) to wait for heat stack to be deleted. (floating point +# value) +#heat_stack_delete_timeout = 3600.0 + +# Time interval(in sec) between checks when waiting for stack +# deletion. (floating point value) +#heat_stack_delete_poll_interval = 1.0 + +# Time(in sec) to wait for stack to be checked. (floating point value) +#heat_stack_check_timeout = 3600.0 + +# Time interval(in sec) between checks when waiting for stack +# checking. (floating point value) +#heat_stack_check_poll_interval = 1.0 + +# Time(in sec) to sleep after updating a resource before polling for +# it status. (floating point value) +#heat_stack_update_prepoll_delay = 2.0 + +# Time(in sec) to wait for stack to be updated. (floating point value) +#heat_stack_update_timeout = 3600.0 + +# Time interval(in sec) between checks when waiting for stack update. +# (floating point value) +#heat_stack_update_poll_interval = 1.0 + +# Time(in sec) to wait for stack to be suspended. (floating point +# value) +#heat_stack_suspend_timeout = 3600.0 + +# Time interval(in sec) between checks when waiting for stack suspend. +# (floating point value) +#heat_stack_suspend_poll_interval = 1.0 + +# Time(in sec) to wait for stack to be resumed. (floating point value) +#heat_stack_resume_timeout = 3600.0 + +# Time interval(in sec) between checks when waiting for stack resume. +# (floating point value) +#heat_stack_resume_poll_interval = 1.0 + +# Time(in sec) to wait for stack snapshot to be created. (floating +# point value) +#heat_stack_snapshot_timeout = 3600.0 + +# Time interval(in sec) between checks when waiting for stack snapshot +# to be created. (floating point value) +#heat_stack_snapshot_poll_interval = 1.0 + +# Time(in sec) to wait for stack to be restored from snapshot. +# (floating point value) +#heat_stack_restore_timeout = 3600.0 + +# Time interval(in sec) between checks when waiting for stack to be +# restored. (floating point value) +#heat_stack_restore_poll_interval = 1.0 + +# Time (in sec) to wait for stack to scale up or down. (floating point +# value) +#heat_stack_scale_timeout = 3600.0 + +# Time interval (in sec) between checks when waiting for a stack to +# scale up or down. (floating point value) +#heat_stack_scale_poll_interval = 1.0 + +# Interval(in sec) between checks when waiting for node creation. +# (floating point value) +#ironic_node_create_poll_interval = 1.0 + +# Delay between creating Manila share and polling for its status. +# (floating point value) +#manila_share_create_prepoll_delay = 2.0 + +# Timeout for Manila share creation. (floating point value) +#manila_share_create_timeout = 300.0 + +# Interval between checks when waiting for Manila share creation. +# (floating point value) +#manila_share_create_poll_interval = 3.0 + +# Timeout for Manila share deletion. (floating point value) +#manila_share_delete_timeout = 180.0 + +# Interval between checks when waiting for Manila share deletion. +# (floating point value) +#manila_share_delete_poll_interval = 2.0 + +# A timeout in seconds for an environment deploy (integer value) +# Deprecated group/name - [DEFAULT]/deploy_environment_timeout +#murano_deploy_environment_timeout = 1200 + +# Deploy environment check interval in seconds (integer value) +# Deprecated group/name - [DEFAULT]/deploy_environment_check_interval +#murano_deploy_environment_check_interval = 5 + +# Time to sleep after start before polling for status (floating point +# value) +#nova_server_start_prepoll_delay = 0.0 + +# Server start timeout (floating point value) +#nova_server_start_timeout = 300.0 + +# Server start poll interval (floating point value) +#nova_server_start_poll_interval = 1.0 + +# Time to sleep after stop before polling for status (floating point +# value) +#nova_server_stop_prepoll_delay = 0.0 + +# Server stop timeout (floating point value) +#nova_server_stop_timeout = 300.0 + +# Server stop poll interval (floating point value) +#nova_server_stop_poll_interval = 2.0 + +# Time to sleep after boot before polling for status (floating point +# value) +#nova_server_boot_prepoll_delay = 1.0 + +# Server boot timeout (floating point value) +#nova_server_boot_timeout = 300.0 + +# Server boot poll interval (floating point value) +#nova_server_boot_poll_interval = 1.0 + +# Time to sleep after delete before polling for status (floating point +# value) +#nova_server_delete_prepoll_delay = 2.0 + +# Server delete timeout (floating point value) +#nova_server_delete_timeout = 300.0 + +# Server delete poll interval (floating point value) +#nova_server_delete_poll_interval = 2.0 + +# Time to sleep after reboot before polling for status (floating point +# value) +#nova_server_reboot_prepoll_delay = 2.0 + +# Server reboot timeout (floating point value) +#nova_server_reboot_timeout = 300.0 + +# Server reboot poll interval (floating point value) +#nova_server_reboot_poll_interval = 2.0 + +# Time to sleep after rebuild before polling for status (floating +# point value) +#nova_server_rebuild_prepoll_delay = 1.0 + +# Server rebuild timeout (floating point value) +#nova_server_rebuild_timeout = 300.0 + +# Server rebuild poll interval (floating point value) +#nova_server_rebuild_poll_interval = 1.0 + +# Time to sleep after rescue before polling for status (floating point +# value) +#nova_server_rescue_prepoll_delay = 2.0 + +# Server rescue timeout (floating point value) +#nova_server_rescue_timeout = 300.0 + +# Server rescue poll interval (floating point value) +#nova_server_rescue_poll_interval = 2.0 + +# Time to sleep after unrescue before polling for status (floating +# point value) +#nova_server_unrescue_prepoll_delay = 2.0 + +# Server unrescue timeout (floating point value) +#nova_server_unrescue_timeout = 300.0 + +# Server unrescue poll interval (floating point value) +#nova_server_unrescue_poll_interval = 2.0 + +# Time to sleep after suspend before polling for status (floating +# point value) +#nova_server_suspend_prepoll_delay = 2.0 + +# Server suspend timeout (floating point value) +#nova_server_suspend_timeout = 300.0 + +# Server suspend poll interval (floating point value) +#nova_server_suspend_poll_interval = 2.0 + +# Time to sleep after resume before polling for status (floating point +# value) +#nova_server_resume_prepoll_delay = 2.0 + +# Server resume timeout (floating point value) +#nova_server_resume_timeout = 300.0 + +# Server resume poll interval (floating point value) +#nova_server_resume_poll_interval = 2.0 + +# Time to sleep after pause before polling for status (floating point +# value) +#nova_server_pause_prepoll_delay = 2.0 + +# Server pause timeout (floating point value) +#nova_server_pause_timeout = 300.0 + +# Server pause poll interval (floating point value) +#nova_server_pause_poll_interval = 2.0 + +# Time to sleep after unpause before polling for status (floating +# point value) +#nova_server_unpause_prepoll_delay = 2.0 + +# Server unpause timeout (floating point value) +#nova_server_unpause_timeout = 300.0 + +# Server unpause poll interval (floating point value) +#nova_server_unpause_poll_interval = 2.0 + +# Time to sleep after shelve before polling for status (floating point +# value) +#nova_server_shelve_prepoll_delay = 2.0 + +# Server shelve timeout (floating point value) +#nova_server_shelve_timeout = 300.0 + +# Server shelve poll interval (floating point value) +#nova_server_shelve_poll_interval = 2.0 + +# Time to sleep after unshelve before polling for status (floating +# point value) +#nova_server_unshelve_prepoll_delay = 2.0 + +# Server unshelve timeout (floating point value) +#nova_server_unshelve_timeout = 300.0 + +# Server unshelve poll interval (floating point value) +#nova_server_unshelve_poll_interval = 2.0 + +# Time to sleep after image_create before polling for status (floating +# point value) +#nova_server_image_create_prepoll_delay = 0.0 + +# Server image_create timeout (floating point value) +#nova_server_image_create_timeout = 300.0 + +# Server image_create poll interval (floating point value) +#nova_server_image_create_poll_interval = 2.0 + +# Time to sleep after image_delete before polling for status (floating +# point value) +#nova_server_image_delete_prepoll_delay = 0.0 + +# Server image_delete timeout (floating point value) +#nova_server_image_delete_timeout = 300.0 + +# Server image_delete poll interval (floating point value) +#nova_server_image_delete_poll_interval = 2.0 + +# Time to sleep after resize before polling for status (floating point +# value) +#nova_server_resize_prepoll_delay = 2.0 + +# Server resize timeout (floating point value) +#nova_server_resize_timeout = 400.0 + +# Server resize poll interval (floating point value) +#nova_server_resize_poll_interval = 5.0 + +# Time to sleep after resize_confirm before polling for status +# (floating point value) +#nova_server_resize_confirm_prepoll_delay = 0.0 + +# Server resize_confirm timeout (floating point value) +#nova_server_resize_confirm_timeout = 200.0 + +# Server resize_confirm poll interval (floating point value) +#nova_server_resize_confirm_poll_interval = 2.0 + +# Time to sleep after resize_revert before polling for status +# (floating point value) +#nova_server_resize_revert_prepoll_delay = 0.0 + +# Server resize_revert timeout (floating point value) +#nova_server_resize_revert_timeout = 200.0 + +# Server resize_revert poll interval (floating point value) +#nova_server_resize_revert_poll_interval = 2.0 + +# Time to sleep after live_migrate before polling for status (floating +# point value) +#nova_server_live_migrate_prepoll_delay = 1.0 + +# Server live_migrate timeout (floating point value) +#nova_server_live_migrate_timeout = 400.0 + +# Server live_migrate poll interval (floating point value) +#nova_server_live_migrate_poll_interval = 2.0 + +# Time to sleep after migrate before polling for status (floating +# point value) +#nova_server_migrate_prepoll_delay = 1.0 + +# Server migrate timeout (floating point value) +#nova_server_migrate_timeout = 400.0 + +# Server migrate poll interval (floating point value) +#nova_server_migrate_poll_interval = 2.0 + +# Nova volume detach timeout (floating point value) +#nova_detach_volume_timeout = 200.0 + +# Nova volume detach poll interval (floating point value) +#nova_detach_volume_poll_interval = 2.0 + +# A timeout in seconds for a cluster create operation (integer value) +# Deprecated group/name - [DEFAULT]/cluster_create_timeout +#sahara_cluster_create_timeout = 1800 + +# A timeout in seconds for a cluster delete operation (integer value) +# Deprecated group/name - [DEFAULT]/cluster_delete_timeout +#sahara_cluster_delete_timeout = 900 + +# Cluster status polling interval in seconds (integer value) +# Deprecated group/name - [DEFAULT]/cluster_check_interval +#sahara_cluster_check_interval = 5 + +# A timeout in seconds for a Job Execution to complete (integer value) +# Deprecated group/name - [DEFAULT]/job_execution_timeout +#sahara_job_execution_timeout = 600 + +# Job Execution status polling interval in seconds (integer value) +# Deprecated group/name - [DEFAULT]/job_check_interval +#sahara_job_check_interval = 5 + +# Amount of workers one proxy should serve to. (integer value) +#sahara_workers_per_proxy = 20 + +# Interval between checks when waiting for a VM to become pingable +# (floating point value) +#vm_ping_poll_interval = 1.0 + +# Time to wait for a VM to become pingable (floating point value) +#vm_ping_timeout = 120.0 + + +[cleanup] + +# +# From rally +# + +# A timeout in seconds for deleting resources (integer value) +#resource_deletion_timeout = 600 + +# Number of cleanup threads to run (integer value) +#cleanup_threads = 20 + + +[database] + +# +# From oslo.db +# + +# The file name to use with SQLite. (string value) +# Deprecated group/name - [DEFAULT]/sqlite_db +#sqlite_db = oslo.sqlite + +# If True, SQLite uses synchronous mode. (boolean value) +# Deprecated group/name - [DEFAULT]/sqlite_synchronous +#sqlite_synchronous = true + +# The back end to use for the database. (string value) +# Deprecated group/name - [DEFAULT]/db_backend +#backend = sqlalchemy + +# The SQLAlchemy connection string to use to connect to the database. +# (string value) +# Deprecated group/name - [DEFAULT]/sql_connection +# Deprecated group/name - [DATABASE]/sql_connection +# Deprecated group/name - [sql]/connection +connection = {{ rally_database_connection_string }} + +# The SQLAlchemy connection string to use to connect to the slave +# database. (string value) +#slave_connection = + +# The SQL mode to be used for MySQL sessions. This option, including +# the default, overrides any server-set SQL mode. To use whatever SQL +# mode is set by the server configuration, set this to no value. +# Example: mysql_sql_mode= (string value) +#mysql_sql_mode = TRADITIONAL + +# Timeout before idle SQL connections are reaped. (integer value) +# Deprecated group/name - [DEFAULT]/sql_idle_timeout +# Deprecated group/name - [DATABASE]/sql_idle_timeout +# Deprecated group/name - [sql]/idle_timeout +#idle_timeout = 3600 + +# Minimum number of SQL connections to keep open in a pool. (integer +# value) +# Deprecated group/name - [DEFAULT]/sql_min_pool_size +# Deprecated group/name - [DATABASE]/sql_min_pool_size +#min_pool_size = 1 + +# Maximum number of SQL connections to keep open in a pool. (integer +# value) +# Deprecated group/name - [DEFAULT]/sql_max_pool_size +# Deprecated group/name - [DATABASE]/sql_max_pool_size +#max_pool_size = + +# Maximum number of database connection retries during startup. Set to +# -1 to specify an infinite retry count. (integer value) +# Deprecated group/name - [DEFAULT]/sql_max_retries +# Deprecated group/name - [DATABASE]/sql_max_retries +#max_retries = 10 + +# Interval between retries of opening a SQL connection. (integer +# value) +# Deprecated group/name - [DEFAULT]/sql_retry_interval +# Deprecated group/name - [DATABASE]/reconnect_interval +#retry_interval = 10 + +# If set, use this value for max_overflow with SQLAlchemy. (integer +# value) +# Deprecated group/name - [DEFAULT]/sql_max_overflow +# Deprecated group/name - [DATABASE]/sqlalchemy_max_overflow +#max_overflow = 50 + +# Verbosity of SQL debugging information: 0=None, 100=Everything. +# (integer value) +# Deprecated group/name - [DEFAULT]/sql_connection_debug +#connection_debug = 0 + +# Add Python stack traces to SQL as comment strings. (boolean value) +# Deprecated group/name - [DEFAULT]/sql_connection_trace +#connection_trace = false + +# If set, use this value for pool_timeout with SQLAlchemy. (integer +# value) +# Deprecated group/name - [DATABASE]/sqlalchemy_pool_timeout +#pool_timeout = + +# Enable the experimental use of database reconnect on connection +# lost. (boolean value) +#use_db_reconnect = false + +# Seconds between retries of a database transaction. (integer value) +#db_retry_interval = 1 + +# If True, increases the interval between retries of a database +# operation up to db_max_retry_interval. (boolean value) +#db_inc_retry_interval = true + +# If db_inc_retry_interval is set, the maximum seconds between retries +# of a database operation. (integer value) +#db_max_retry_interval = 10 + +# Maximum retries in case of connection error or deadlock error before +# error is raised. Set to -1 to specify an infinite retry count. +# (integer value) +#db_max_retries = 20 + + +[image] + +# +# From rally +# + +# CirrOS image URL (string value) +#cirros_img_url = http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img + +# Image disk format to use when creating the image (string value) +#disk_format = qcow2 + +# Image container format to use when creating the image (string value) +#container_format = bare + +# Regular expression for name of an image to discover it in the cloud +# and use it for the tests. Note that when Rally is searching for the +# image, case insensitive matching is performed. Specify nothing +# ('name_regex =') if you want to disable discovering. In this case +# Rally will create needed resources by itself if the values for the +# corresponding config options are not specified in the Tempest config +# file (string value) +#name_regex = ^.*(cirros|testvm).*$ + + +[role] + +# +# From rally +# + +# Role required for users to be able to create Swift containers +# (string value) +#swift_operator_role = Member + +# User role that has reseller admin (string value) +#swift_reseller_admin_role = ResellerAdmin + +# Role required for users to be able to manage Heat stacks (string +# value) +#heat_stack_owner_role = heat_stack_owner + +# Role for Heat template-defined users (string value) +#heat_stack_user_role = heat_stack_user + + +[users_context] + +# +# From rally +# + +# How many concurrent threads use for serving users context (integer +# value) +#resource_management_workers = 30 + +# ID of domain in which projects will be created. (string value) +#project_domain = default + +# ID of domain in which users will be created. (string value) +#user_domain = default \ No newline at end of file diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..3422d65 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,8 @@ +ansible-lint<=2.3.9 +ansible>=1.9.1,<2.0.0 +bashate +flake8 + +# this is required for the docs build jobs +sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 +oslosphinx>=2.5.0 # Apache-2.0 diff --git a/tests/inventory b/tests/inventory new file mode 100644 index 0000000..d18580b --- /dev/null +++ b/tests/inventory @@ -0,0 +1 @@ +localhost \ No newline at end of file diff --git a/tests/test.yml b/tests/test.yml new file mode 100644 index 0000000..02bbe44 --- /dev/null +++ b/tests/test.yml @@ -0,0 +1,19 @@ +--- +# Copyright 2016, Comcast Corporation +# +# 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. + +- hosts: localhost + remote_user: root + roles: + - openstack-ansible-os_rally \ No newline at end of file diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..8c811fc --- /dev/null +++ b/tox.ini @@ -0,0 +1,136 @@ +[tox] +minversion = 1.6 +skipsdist = True +envlist = docs,linters,functional + + +[testenv] +usedevelop = True +install_command = pip install -U {opts} {packages} +deps = -r{toxinidir}/test-requirements.txt +commands = /usr/bin/find . -type f -name "*.pyc" -delete +passenv = + HOME +whitelist_externals = + bash + git + rm + wget +setenv = + VIRTUAL_ENV={envdir} + ANSIBLE_HOST_KEY_CHECKING = False + ANSIBLE_SSH_CONTROL_PATH = /tmp/%%h-%%r + # TODO (odyssey4me) These are only here as they are non-standard folder + # names for Ansible 1.9.x. We are using the standard folder names for + # Ansible v2.x. We can remove this when we move to Ansible 2.x. + ANSIBLE_ACTION_PLUGINS = {homedir}/.ansible/plugins/action + ANSIBLE_CALLBACK_PLUGINS = {homedir}/.ansible/plugins/callback + ANSIBLE_FILTER_PLUGINS = {homedir}/.ansible/plugins/filter + ANSIBLE_LOOKUP_PLUGINS = {homedir}/.ansible/plugins/lookup + # This is required as the default is the current path or a path specified + # in ansible.cfg + ANSIBLE_LIBRARY = {homedir}/.ansible/plugins/library + # This is required as the default is '/etc/ansible/roles' or a path + # specified in ansible.cfg + ANSIBLE_ROLES_PATH = {homedir}/.ansible/roles:{toxinidir}/.. + + +[testenv:docs] +commands= + python setup.py build_sphinx + + +# environment used by the -infra templated docs job +[testenv:venv] +deps = -r{toxinidir}/test-requirements.txt +commands = {posargs} + + +[testenv:pep8] +commands = + # Run hacking/flake8 check for all python files + bash -c "grep --recursive --binary-files=without-match \ + --files-with-match '^.!.*python$' \ + --exclude-dir .eggs \ + --exclude-dir .git \ + --exclude-dir .tox \ + --exclude-dir *.egg-info \ + --exclude-dir doc \ + {toxinidir} | xargs flake8 --verbose" + +[flake8] +# Ignores the following rules due to how ansible modules work in general +# F403 'from ansible.module_utils.basic import *' used; +# unable to detect undefined names +# H303 No wildcard (*) import. +ignore=F403,H303 + + +[testenv:bashate] +commands = + # Run bashate check for all bash scripts + # Ignores the following rules: + # E003: Indent not multiple of 4 (we prefer to use multiples of 2) + # E006: Line longer than 79 columns (as many scripts use jinja + # templating, this is very difficult) + # E040: Syntax error determined using `bash -n` (as many scripts + # use jinja templating, this will often fail and the syntax + # error will be discovered in execution anyway) + bash -c "grep --recursive --binary-files=without-match \ + --files-with-match '^.!.*\(ba\)\?sh$' \ + --exclude-dir .tox \ + --exclude-dir .git \ + {toxinidir} | xargs bashate --error . --verbose --ignore=E003,E006,E040" + + +[testenv:ansible-syntax] +commands = + rm -rf {homedir}/.ansible + git clone https://git.openstack.org/openstack/openstack-ansible-plugins \ + {homedir}/.ansible/plugins + ansible-galaxy install \ + --role-file={toxinidir}/tests/ansible-role-requirements.yml \ + --ignore-errors \ + --force + ansible-playbook -i {toxinidir}/tests/inventory \ + --syntax-check \ + --list-tasks \ + -e "rolename={toxinidir}" \ + {toxinidir}/tests/test.yml + + +[testenv:ansible-lint] +commands = + ansible-lint {toxinidir}/tests/test.yml + + +[testenv:functional] +commands = + echo -e "\n *******************************************************\n" \ + "**** Functional Testing is still to be implemented ****\n" \ + "**** TODO: Write tests here ****\n" \ + "*******************************************************\n" + # As a temporary measure, while functional testing is being worked on, we + # will not execute the functional test. This allows other patches to be + # worked on while the functional testing is being worked out. + #rm -rf {homedir}/.ansible + #git clone https://git.openstack.org/openstack/openstack-ansible-plugins \ + # {homedir}/.ansible/plugins + # This plugin makes the ansible-playbook output easier to read + #wget -O {homedir}/.ansible/plugins/callback/human_log.py \ + # https://gist.githubusercontent.com/cliffano/9868180/raw/f360f306b3c6d689734a6aa8773a00edf16a0054/human_log.py + #ansible-galaxy install \ + # --role-file={toxinidir}/tests/ansible-role-requirements.yml \ + # --ignore-errors \ + # --force + #ansible-playbook -i {toxinidir}/tests/inventory \ + # -e "rolename={toxinidir}" \ + # {toxinidir}/tests/test.yml + + +[testenv:linters] +commands = + {[testenv:pep8]commands} + {[testenv:bashate]commands} + {[testenv:ansible-lint]commands} + {[testenv:ansible-syntax]commands} diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..f27d52e --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,14 @@ +--- +# Copyright 2016, Comcast Corporation +# +# 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.