diff --git a/.gitignore b/.gitignore
index bc63beb..5421f90 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,71 @@
-# empty
\ No newline at end of file
+# 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
+logs/*
+
+# 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
+*.swp
+
+# Generated by pbr while building docs
+######################################
+AUTHORS
+ChangeLog
+
+# Files created by releasenotes build
+releasenotes/build
+
+# Test temp files
+tests/common
+tests/*.retry
+
+# Vagrant artifacts
+.vagrant
+
+# Git clones
+openstack-ansible-ops
diff --git a/.gitreview b/.gitreview
index bc63beb..54d1475 100644
--- a/.gitreview
+++ b/.gitreview
@@ -1 +1,4 @@
-# empty
\ No newline at end of file
+[gerrit]
+host=review.openstack.org
+port=29418
+project=openstack/openstack-ansible-os_congress.git
diff --git a/README.md b/README.md
deleted file mode 100644
index bb73075..0000000
--- a/README.md
+++ /dev/null
@@ -1,4 +0,0 @@
-OpenStack-Ansible Congress
-==========================
-
-Ansible role that will install and configure Congress, a policy framework for OpenStack.
\ No newline at end of file
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..b88c04e
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,10 @@
+==========================
+OpenStack-Ansible Congress
+==========================
+
+Ansible role that will install and configure Congress, a policy framework for OpenStack.
+
+Documentation for the project can be found at:
+``_
+The project home is at:
+``_
\ No newline at end of file
diff --git a/bindep.txt b/bindep.txt
new file mode 100644
index 0000000..5a05c5a
--- /dev/null
+++ b/bindep.txt
@@ -0,0 +1,52 @@
+# This file facilitates OpenStack-CI package installation
+# before the execution of any tests.
+#
+# See the following for details:
+# - https://docs.openstack.org/infra/bindep/
+# - https://git.openstack.org/cgit/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.
+#
+# Note:
+# This file is maintained in the openstack-ansible-tests repository.
+# https://git.openstack.org/cgit/openstack/openstack-ansible-tests/tree/bindep.txt
+# If you need to remove or add extra dependencies, you should modify
+# the central file instead and once your change is accepted then update
+# this file as well. The purpose of this file is to ensure that Python and
+# Ansible have all their necessary binary requirements on the test host before
+# tox executes. Any binary requirements needed by services/roles should be
+# installed by those roles in their applicable package install tasks, not through
+# using this file.
+#
+
+# The gcc compiler
+gcc
+
+# Base requirements for Ubuntu
+git-core [platform:dpkg]
+libssl-dev [platform:dpkg]
+libffi-dev [platform:dpkg]
+python2.7 [platform:dpkg]
+python-apt [platform:dpkg]
+python-dev [platform:dpkg]
+python3 [platform:dpkg]
+python3-apt [platform:dpkg]
+python3-dev [platform:dpkg]
+
+# Base requirements for RPM distros
+gcc-c++ [platform:rpm]
+git [platform:rpm]
+libffi-devel [platform:rpm]
+openssl-devel [platform:rpm]
+python-devel [platform:rpm]
+python2-dnf [platform:fedora]
+
+# For SELinux
+libselinux-python [platform:redhat]
+libsemanage-python [platform:redhat]
+
+# Required for compressing collected log files in CI
+gzip
diff --git a/defaults/main.yml b/defaults/main.yml
index 11fc115..a793055 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -14,32 +14,43 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+## Verbosity Options
+debug: False
+
+## Set the package install state for distribution packages
+congress_pip_package_state: "latest"
congress_package_state: "latest"
+## Git repositories and their branches
congress_git_repo: https://git.openstack.org/openstack/congress
congress_git_install_branch: master
congress_developer_mode: false
-congress_requirements_git_repo: https://git.openstack.org/openstack/requirements
-congress_requirements_git_install_branch: master
+congress_developer_constraints:
+ - "git+{{ congress_git_repo }}@{{ congress_git_install_branch }}#egg=congress"
+## Virtual environment to deploy into
congress_venv_tag: untagged
congress_bin: "/openstack/venvs/congress-{{ congress_venv_tag }}/bin"
-congress_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/congress.tgz
+## configuration directory
+congress_etc_dir: "/etc/congress"
-congress_etc_dir: "{{ congress_bin | dirname }}/etc/congress"
-congress_conf_dir: /etc/congress
+# venv_download, even when true, will use the fallback method of building the
+# venv from scratch if the venv download fails.
+congress_venv_download: "{{ not congress_developer_mode | bool }}"
+congress_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/congress.tgz
## Required PIP packages
congress_requires_pip_packages:
- - tox
- virtualenv
- - virtualenv-tools
- - python-keystoneclient
+ - python-keystoneclient # Keystoneclient needed to OSA keystone lib
-## congress developer constraint
-congress_developer_constraints:
- - - "git+{{ congress_git_repo }}@{{ congress_git_install_branch }}#egg=congress"
+## Common PIP packages
+congress_pip_packages:
+ - congress
+ - pymysql
+ - python-congressclient
+ - python-heatclient
## System info
congress_system_user_name: congress
@@ -47,14 +58,7 @@ congress_system_group_name: congress
congress_system_shell: /bin/false
congress_system_comment: congress system user
congress_system_user_home: "/var/lib/{{ congress_system_user_name }}"
-
-## Database credentials
-congress_db_name: congress
-congress_db_user: root
-congress_db_login_host: ""
-congress_db_login_user: ""
-congress_db_login_password: ""
-congress_db_user_password: ""
+congress_config_options: "--config-file={{ congress_etc_dir }}/congress.conf --logfile /var/log/congress/{{ congress_program_name }}.log"
## Service Type and Data
congress_service_region: RegionOne
@@ -73,23 +77,39 @@ congress_service_publicuri_proto: "{{ openstack_service_publicuri_proto | defaul
congress_service_adminuri_proto: "{{ openstack_service_adminuri_proto | default(congress_service_proto) }}"
congress_service_internaluri_proto: "{{ openstack_service_internaluri_proto | default(congress_service_proto) }}"
-#NOTE: move password to tests/test-vars.yml
-congress_service_password: password
-
## Keystone
congress_service_project_domain_id: default
congress_service_project_name: service
congress_service_user_domain_id: default
congress_service_user_name: congress
congress_keystone_auth_plugin: password
-
congress_service_in_ldap: false
## DB info
congress_galera_database: congress
congress_galera_user: congress
+congress_galera_use_ssl: "{{ galera_use_ssl | default(False) }}"
+congress_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('/etc/ssl/certs/galera-ca.pem') }}"
+## Service info
congress_role_name: admin
congress_bind_address: 0.0.0.0
-congress_service_port: 9800
-congress_program_name: congress-server
\ No newline at end of file
+congress_service_port: 1789
+congress_program_name: congress-server
+
+## RabbitMQ info
+congress_rabbitmq_userid: congress
+congress_rabbitmq_vhost: /congress
+congress_rabbitmq_port: 5672
+congress_rabbitmq_servers: 127.0.0.1
+congress_rabbitmq_use_ssl: False
+
+# This variable is used by the repo_build process to determine
+# which host group to check for members of before building the
+# pip packages required by this role. The value is picked up
+# by the py_pkgs lookup.
+congress_role_project_group: congress_all
+
+## Tunable overrides
+congress_congress_api_paste_ini_overrides: {}
+congress_congress_conf_overrides: {}
diff --git a/doc/Makefile b/doc/Makefile
new file mode 100644
index 0000000..4d3b2f6
--- /dev/null
+++ b/doc/Makefile
@@ -0,0 +1,195 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+PAPER =
+BUILDDIR = build
+
+# User-friendly check for sphinx-build
+ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
+$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
+endif
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
+
+help:
+ @echo "Please use \`make ' where is one of"
+ @echo " html to make standalone HTML files"
+ @echo " dirhtml to make HTML files named index.html in directories"
+ @echo " singlehtml to make a single large HTML file"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " qthelp to make HTML files and a qthelp project"
+ @echo " applehelp to make an Apple Help Book"
+ @echo " devhelp to make HTML files and a Devhelp project"
+ @echo " epub to make an epub"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " latexpdf to make LaTeX files and run them through pdflatex"
+ @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
+ @echo " text to make text files"
+ @echo " man to make manual pages"
+ @echo " texinfo to make Texinfo files"
+ @echo " info to make Texinfo files and run them through makeinfo"
+ @echo " gettext to make PO message catalogs"
+ @echo " changes to make an overview of all changed/added/deprecated items"
+ @echo " xml to make Docutils-native XML files"
+ @echo " pseudoxml to make pseudoxml-XML files for display purposes"
+ @echo " linkcheck to check all external links for integrity"
+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"
+ @echo " coverage to run coverage check of the documentation (if enabled)"
+
+clean:
+ rm -rf $(BUILDDIR)/*
+
+html:
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+ $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+ @echo
+ @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
+
+json:
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+ @echo
+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/openstack-ansible-lxc_hosts.qhcp"
+ @echo "To view the help file:"
+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/openstack-ansible-lxc_hosts.qhc"
+
+applehelp:
+ $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
+ @echo
+ @echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
+ @echo "N.B. You won't be able to view it unless you put it in" \
+ "~/Library/Documentation/Help or install it in your application" \
+ "bundle."
+
+devhelp:
+ $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+ @echo
+ @echo "Build finished."
+ @echo "To view the help file:"
+ @echo "# mkdir -p $$HOME/.local/share/devhelp/openstack-ansible-lxc_hosts"
+ @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/openstack-ansible-lxc_hosts"
+ @echo "# devhelp"
+
+epub:
+ $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+ @echo
+ @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+ @echo "Run \`make' in that directory to run these through (pdf)latex" \
+ "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through pdflatex..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+latexpdfja:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through platex and dvipdfmx..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+ $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+ @echo
+ @echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+ $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+ @echo
+ @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+texinfo:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo
+ @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+ @echo "Run \`make' in that directory to run these through makeinfo" \
+ "(use \`make info' here to do that automatically)."
+
+info:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo "Running Texinfo files through makeinfo..."
+ make -C $(BUILDDIR)/texinfo info
+ @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+gettext:
+ $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+ @echo
+ @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+changes:
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+ @echo
+ @echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+ @echo "Testing of doctests in the sources finished, look at the " \
+ "results in $(BUILDDIR)/doctest/output.txt."
+
+coverage:
+ $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
+ @echo "Testing of coverage in the sources finished, look at the " \
+ "results in $(BUILDDIR)/coverage/python.txt."
+
+xml:
+ $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
+ @echo
+ @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
+
+pseudoxml:
+ $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
+ @echo
+ @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
+
+livehtml: html
+sphinx-autobuild -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
\ No newline at end of file
diff --git a/doc/source/conf.py b/doc/source/conf.py
new file mode 100644
index 0000000..2b86734
--- /dev/null
+++ b/doc/source/conf.py
@@ -0,0 +1,327 @@
+#!/usr/bin/env python3
+
+# 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 execfile()d with the current directory set to its
+# containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import pbr.version
+import os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+# sys.path.insert(0, os.path.abspath('.'))
+
+# -- General configuration ------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+# needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = [
+ 'openstackdocstheme',
+ 'sphinx.ext.autodoc',
+ 'sphinxmark'
+]
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix(es) of source filenames.
+# You can specify multiple suffix as a list of string:
+# source_suffix = ['.rst', '.md']
+source_suffix = '.rst'
+
+# The encoding of source files.
+# source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+author = 'OpenStack-Ansible Contributors'
+category = 'Miscellaneous'
+copyright = '2014-2016, OpenStack-Ansible Contributors'
+description = 'OpenStack-Ansible deploys OpenStack environments using Ansible.'
+project = 'OpenStack-Ansible'
+role_name = 'os_congress'
+target_name = 'openstack-ansible-' + role_name
+title = 'OpenStack-Ansible Documentation: ' + role_name + 'role'
+
+# The link to the browsable source code (for the left hand menu)
+oslosphinx_cgit_link = (
+ "https://git.openstack.org/cgit/openstack/{}".format(target_name)
+)
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version_info = pbr.version.VersionInfo(target_name)
+# The full version, including alpha/beta/rc tags.
+release = version_info.version_string_with_vcs()
+# The short X.Y version.
+version = version_info.canonical_version_string()
+
+# openstackdocstheme options
+repository_name = 'openstack/' + target_name
+bug_project = project.lower()
+bug_tag = ''
+
+# for a list of supported languages.
+#
+# This is also used if you do content translation via gettext catalogs.
+# Usually you set "language" from the command line for these cases.
+language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+# today = ''
+# Else, today_fmt is used as the format for a strftime call.
+# today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = []
+
+# The reST default role (used for this markup: `text`) to use for all
+# documents.
+# default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+# add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+# add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+# show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+# modindex_common_prefix = []
+
+# If true, keep warnings as "system message" paragraphs in the built documents.
+# keep_warnings = False
+
+# If true, `todo` and `todoList` produce output, else they produce nothing.
+todo_include_todos = False
+
+
+# -- Options for HTML output ----------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+html_theme = 'openstackdocs'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+# html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+# html_theme_path = []
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# " v documentation".
+# html_title = None
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+# html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+# html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+# html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# Add any extra paths that contain custom files (such as robots.txt or
+# .htaccess) here, relative to this directory. These files are copied
+# directly to the root of the documentation.
+# html_extra_path = []
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+html_last_updated_fmt = '%Y-%m-%d %H:%M'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+# html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+# html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+# html_additional_pages = {}
+
+# If false, no module index is generated.
+# html_domain_indices = True
+
+# If false, no index is generated.
+# html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+# html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+# html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+# html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+# html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+# html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+# html_file_suffix = None
+
+# Language to be used for generating the HTML full-text search index.
+# Sphinx supports the following languages:
+# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
+# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
+# html_search_language = 'en'
+
+# A dictionary with options for the search language support, empty by default.
+# Now only 'ja' uses this config value
+# html_search_options = {'type': 'default'}
+
+# The name of a javascript file (relative to the configuration directory) that
+# implements a search results scorer. If empty, the default will be used.
+# html_search_scorer = 'scorer.js'
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = target_name + '-docs'
+
+# -- Options for LaTeX output ---------------------------------------------
+
+latex_elements = {
+ # The paper size ('letterpaper' or 'a4paper').
+ # 'papersize': 'letterpaper',
+
+ # The font size ('10pt', '11pt' or '12pt').
+ # 'pointsize': '10pt',
+
+ # Additional stuff for the LaTeX preamble.
+ # 'preamble': '',
+
+ # Latex figure (float) alignment
+ # 'figure_align': 'htbp',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title,
+# author, documentclass [howto, manual, or own class]).
+latex_documents = [
+ (master_doc, target_name + '.tex',
+ title, author, 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+# latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+# latex_use_parts = False
+
+# If true, show page references after internal links.
+# latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+# latex_show_urls = False
+
+# Documents to append as an appendix to all manuals.
+# latex_appendices = []
+
+# If false, no module index is generated.
+# latex_domain_indices = True
+
+
+# -- Options for manual page output ---------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+ (master_doc, target_name,
+ title, [author], 1)
+]
+
+# If true, show URL addresses after external links.
+# man_show_urls = False
+
+
+# -- Options for Texinfo output -------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+# dir menu entry, description, category)
+texinfo_documents = [
+ (master_doc, target_name,
+ title, author, project,
+ description, category),
+]
+
+# Documents to append as an appendix to all manuals.
+# texinfo_appendices = []
+
+# If false, no module index is generated.
+# texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+# texinfo_show_urls = 'footnote'
+
+# If true, do not generate a @detailmenu in the "Top" node's menu.
+# texinfo_no_detailmenu = False
+
+
+watermark = os.popen("git branch --contains $(git rev-parse HEAD)\
+| awk -F/ '/stable/ {print $2}'").read().strip(' \n\t').capitalize()
+if watermark == "":
+ watermark = "Pre-release"
+
+# -- Options for sphinxmark -----------------------------------------------
+sphinxmark_enable = True
+sphinxmark_div = 'docs-body'
+sphinxmark_image = 'text'
+sphinxmark_text = watermark
+sphinxmark_text_color = (128, 128, 128)
+sphinxmark_text_size = 70
diff --git a/doc/source/index.rst b/doc/source/index.rst
new file mode 100644
index 0000000..7664632
--- /dev/null
+++ b/doc/source/index.rst
@@ -0,0 +1,33 @@
+===================================
+Congress role for OpenStack-Ansible
+===================================
+
+:tags: openstack, congress, cloud, ansible
+:category: \*nix
+
+To clone or view the source code for this repository, visit the role repository
+for `os_congress `_.
+
+Default variables
+~~~~~~~~~~~~~~~~~
+
+.. literalinclude:: ../../defaults/main.yml
+ :language: yaml
+ :start-after: under the License.
+
+Dependencies
+~~~~~~~~~~~~
+
+This role needs pip >= 7.1 installed on the target host.
+
+Example playbook
+~~~~~~~~~~~~~~~~
+
+.. literalinclude:: ../../examples/playbook.yml
+ :language: yaml
+
+Tags
+~~~~
+
+- congress-install
+- congress-config
diff --git a/handlers/main.yml b/handlers/main.yml
index 62b0a2e..ed2fe5b 100644
--- a/handlers/main.yml
+++ b/handlers/main.yml
@@ -1,2 +1,50 @@
---
-# handlers file for os_congress
+# Copyright 2017, taseer94@gmail.com
+# All rights reserved.
+#
+# 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: Stop services
+ service:
+ name: "{{ congress_program_name }}"
+ enabled: yes
+ state: "started"
+ daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}"
+ register: _stop
+ until: _stop | success
+ retries: 5
+ delay: 2
+ listen: "Restart congress services"
+
+- name: Start services
+ service:
+ name: "{{ congress_program_name }}"
+ enabled: yes
+ state: "started"
+ daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}"
+ register: _start
+ until: _start | success
+ retries: 5
+ delay: 2
+ listen: "Restart congress services"
+
+- name: Wait for service to be ready
+ wait_for:
+ port: "{{ congress_service_port }}"
+ timeout: 25
+ delay: 10
+ register: _wait_check
+ until: _wait_check | success
+ retries: 5
+ listen: "Restart congress services"
+
diff --git a/meta/main.yml b/meta/main.yml
index 3e8e684..157e566 100644
--- a/meta/main.yml
+++ b/meta/main.yml
@@ -16,26 +16,25 @@
galaxy_info:
- author: Taseer
+ author: Taseer Ahmed
+ email: taseer94@gmail.com
description: Congress deployment with OpenStack Ansible
company: Independent
license: Apache2
-
- min_ansible_version: 1.0
-
+ min_ansible_version: 2.3
platforms:
- name: Ubuntu
versions:
- - trusty
- xenial
galaxy_tags:
- cloud
- - openstack
- - congress
- python
-
+ - congress
+ - development
+ - openstack
dependencies:
- - pip_install
- role: apt_package_pinning
when:
- ansible_pkg_mgr == 'apt'
+ - galera_client
+ - openstack_openrc
diff --git a/meta/openstack-ansible.yml b/meta/openstack-ansible.yml
new file mode 100644
index 0000000..433c0d6
--- /dev/null
+++ b/meta/openstack-ansible.yml
@@ -0,0 +1,20 @@
+---
+# Copyright 2017, 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.
+#
+# (c) 2017, Jean-Philippe Evrard
+
+maturity_info:
+ status: Incubated
+ created_during: Queens
diff --git a/releasenotes/source/_static/.placeholder b/releasenotes/source/_static/.placeholder
new file mode 100644
index 0000000..e69de29
diff --git a/releasenotes/source/_templates/.placeholder b/releasenotes/source/_templates/.placeholder
new file mode 100644
index 0000000..e69de29
diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py
new file mode 100644
index 0000000..185dfa0
--- /dev/null
+++ b/releasenotes/source/conf.py
@@ -0,0 +1,285 @@
+#!/usr/bin/env python3
+
+# 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 execfile()d with the current directory set to its
+# containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+# sys.path.insert(0, os.path.abspath('.'))
+
+# -- General configuration ------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+# needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = [
+ 'openstackdocstheme',
+ 'reno.sphinxext',
+]
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+# source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+author = 'OpenStack-Ansible Contributors'
+category = 'Miscellaneous'
+copyright = '2014-2016, OpenStack-Ansible Contributors'
+description = 'OpenStack-Ansible deploys OpenStack environments using Ansible.'
+project = 'OpenStack-Ansible'
+role_name = 'os_congress'
+target_name = 'openstack-ansible-' + role_name
+title = 'OpenStack-Ansible Release Notes: ' + role_name + 'role'
+
+# The link to the browsable source code (for the left hand menu)
+oslosphinx_cgit_link = (
+ 'https://git.openstack.org/cgit/openstack/{}'.format(target_name)
+)
+
+# Release notes do not need a version number in the title, they
+# cover multiple releases.
+# The full version, including alpha/beta/rc tags.
+release = ''
+# The short X.Y version.
+version = ''
+
+# openstackdocstheme options
+repository_name = 'openstack/' + target_name
+bug_project = project.lower()
+bug_tag = ''
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+# language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+# today = ''
+# Else, today_fmt is used as the format for a strftime call.
+# today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = []
+
+# The reST default role (used for this markup: `text`) to use for all
+# documents.
+# default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+# add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+# add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+# show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+# modindex_common_prefix = []
+
+# If true, keep warnings as "system message" paragraphs in the built documents.
+# keep_warnings = False
+
+
+# -- Options for HTML output ----------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+html_theme = 'openstackdocs'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+# html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+# html_theme_path = []
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# " v documentation".
+# html_title = None
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+# html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+# html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+# html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# Add any extra paths that contain custom files (such as robots.txt or
+# .htaccess) here, relative to this directory. These files are copied
+# directly to the root of the documentation.
+# html_extra_path = []
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+html_last_updated_fmt = '%Y-%m-%d %H:%M'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+# html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+# html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+# html_additional_pages = {}
+
+# If false, no module index is generated.
+# html_domain_indices = True
+
+# If false, no index is generated.
+# html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+# html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+# html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+# html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+# html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+# html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+# html_file_suffix = None
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = target_name + '-docs'
+
+
+# -- Options for LaTeX output ---------------------------------------------
+
+latex_elements = {
+ # The paper size ('letterpaper' or 'a4paper').
+ # 'papersize': 'letterpaper',
+
+ # The font size ('10pt', '11pt' or '12pt').
+ # 'pointsize': '10pt',
+
+ # Additional stuff for the LaTeX preamble.
+ # 'preamble': '',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title,
+# author, documentclass [howto, manual, or own class]).
+latex_documents = [
+ (master_doc, target_name + '.tex',
+ title, author, 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+# latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+# latex_use_parts = False
+
+# If true, show page references after internal links.
+# latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+# latex_show_urls = False
+
+# Documents to append as an appendix to all manuals.
+# latex_appendices = []
+
+# If false, no module index is generated.
+# latex_domain_indices = True
+
+
+# -- Options for manual page output ---------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+ (master_doc, target_name,
+ title, [author], 1)
+]
+
+# If true, show URL addresses after external links.
+# man_show_urls = False
+
+
+# -- Options for Texinfo output -------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+# dir menu entry, description, category)
+texinfo_documents = [
+ (master_doc, target_name,
+ title, author, project,
+ description, category),
+]
+
+# Documents to append as an appendix to all manuals.
+# texinfo_appendices = []
+
+# If false, no module index is generated.
+# texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+# texinfo_show_urls = 'footnote'
+
+# If true, do not generate a @detailmenu in the "Top" node's menu.
+# texinfo_no_detailmenu = False
+
+# -- Options for Internationalization output ------------------------------
+locale_dirs = ['locale/']
diff --git a/releasenotes/source/index.rst b/releasenotes/source/index.rst
new file mode 100644
index 0000000..03f82f4
--- /dev/null
+++ b/releasenotes/source/index.rst
@@ -0,0 +1,4 @@
+.. toctree::
+ :maxdepth: 1
+
+ unreleased
diff --git a/releasenotes/source/unreleased.rst b/releasenotes/source/unreleased.rst
new file mode 100644
index 0000000..9e59132
--- /dev/null
+++ b/releasenotes/source/unreleased.rst
@@ -0,0 +1,6 @@
+==============================
+ Current Series Release Notes
+==============================
+
+
+.. release-notes::
diff --git a/run_tests.sh b/run_tests.sh
old mode 100644
new mode 100755
index 23ec75a..4b72d3f
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -40,8 +40,7 @@ install_pkg_deps() {
case ${ID,,} in
*suse*) pkg_mgr_cmd="zypper -n in" ;;
- centos|rhel) pkg_mgr_cmd="${RHT_PKG_MGR} install -y" ;;
- fedora) pkg_mgr_cmd="dnf -y install" ;;
+ centos|rhel|fedora) pkg_mgr_cmd="${RHT_PKG_MGR} install -y" ;;
ubuntu|debian) pkg_mgr_cmd="apt-get install -y" ;;
*) echo "unsupported distribution: ${ID,,}"; exit 1 ;;
esac
@@ -49,23 +48,12 @@ install_pkg_deps() {
eval sudo $pkg_mgr_cmd $pkg_deps
}
-git_clone_repo() {
- if [[ ! -d tests/common ]]; then
- # The tests repo doesn't need a clone, we can just
- # symlink it.
- if [[ "$(basename ${WORKING_DIR})" == "openstack-ansible-tests" ]]; then
- ln -s ${WORKING_DIR} ${WORKING_DIR}/tests/common
- else
- git clone \
- https://git.openstack.org/openstack/openstack-ansible-tests \
- tests/common
- fi
- fi
-}
-
+# Install the host distro package dependencies
install_pkg_deps
-git_clone_repo
+# Clone the tests repo for access to the common test script
+source tests/tests-repo-clone.sh
+
+# Execute the common test script
+source tests/common/run_tests_common.sh
-# start executing the main test script
-source tests/common/run_tests_common.sh
\ No newline at end of file
diff --git a/setup.py b/setup.py
index 596abfc..9c3b9d3 100644
--- a/setup.py
+++ b/setup.py
@@ -16,4 +16,4 @@ import setuptools
setuptools.setup(
setup_requires=['pbr>=2.0.0'],
- pbr=True)
\ No newline at end of file
+ pbr=True)
diff --git a/tasks/congress_db_setup.yml b/tasks/congress_db_setup.yml
index 71410da..a6b893d 100644
--- a/tasks/congress_db_setup.yml
+++ b/tasks/congress_db_setup.yml
@@ -15,8 +15,9 @@
# limitations under the License.
- name: create congress database schema
- command: "{{ congress_bin }}/congress-db-manage
- --config-file {{ congress_conf_dir }}/congress.conf upgrade head"
+ command: >
+ {{ congress_bin }}/congress-db-manage
+ --config-file {{ congress_etc_dir }}/congress.conf upgrade head
become: yes
become_user: "{{ congress_system_user_name }}"
- changed_when: False
\ No newline at end of file
+ changed_when: False
diff --git a/tasks/congress_init_systemd.yml b/tasks/congress_init_systemd.yml
new file mode 100644
index 0000000..c5eb26e
--- /dev/null
+++ b/tasks/congress_init_systemd.yml
@@ -0,0 +1,52 @@
+---
+# Copyright 2017, taseer94@gmail.com
+# All rights reserved.
+#
+# 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 TEMP run dir
+ file:
+ path: "/var/run/{{ congress_program_name }}"
+ state: directory
+ owner: "{{ congress_system_user_name }}"
+ group: "{{ congress_system_group_name }}"
+ mode: "02755"
+
+- name: Create TEMP lock dir
+ file:
+ path: "/var/lock/{{ congress_program_name }}"
+ state: directory
+ owner: "{{ congress_system_user_name }}"
+ group: "{{ congress_system_group_name }}"
+ mode: "02755"
+
+- name: Create tmpfiles.d entry
+ template:
+ src: "congress-systemd-tmpfiles.j2"
+ dest: "/etc/tmpfiles.d/openstack-{{ congress_program_name }}.conf"
+ mode: "0644"
+ owner: "root"
+ group: "root"
+ notify:
+ - Restart congress services
+
+- name: Place the systemd init script
+ config_template:
+ src: "congress-systemd-init.j2"
+ dest: "/etc/systemd/system/{{ congress_program_name }}.service"
+ mode: "0644"
+ owner: "root"
+ group: "root"
+ config_type: "ini"
+ notify:
+ - Restart congress services
diff --git a/tasks/congress_install.yml b/tasks/congress_install.yml
index 047d021..2610515 100644
--- a/tasks/congress_install.yml
+++ b/tasks/congress_install.yml
@@ -14,10 +14,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-#- name: install congress
-# shell: python setup.py install
-# args:
-# chdir: /opt/congress
+- name: Install distro packages
+ package:
+ name: "{{ congress_distro_packages }}"
+ state: "{{ congress_package_state }}"
+ update_cache: "{{ (ansible_pkg_mgr in ['apt', 'zypper']) | ternary('yes', omit) }}"
+ cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
+ register: install_packages
+ until: install_packages | success
+ retries: 5
+ delay: 2
- name: Create developer mode constraint file
copy:
@@ -30,8 +36,8 @@
- name: Install required pip packages
pip:
- name: "{{ congress_requires_pip_packages | join(' ') }}"
- state: "{{ congress_package_state }}"
+ name: "{{ congress_requires_pip_packages }}"
+ state: "{{ congress_pip_package_state }}"
extra_args: >-
{{ congress_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }}
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
@@ -46,7 +52,7 @@
url: "{{ congress_venv_download_url | replace('tgz', 'checksum') }}"
return_content: yes
register: congress_venv_checksum
- when: not congress_developer_mode | bool
+ when: congress_venv_download | bool
- name: Attempt venv download
get_url:
@@ -54,7 +60,7 @@
dest: "/var/cache/{{ congress_venv_download_url | basename }}"
checksum: "sha1:{{ congress_venv_checksum.content | trim }}"
register: congress_get_venv
- when: not congress_developer_mode | bool
+ when: congress_venv_download | bool
- name: Remove existing venv
file:
@@ -74,28 +80,42 @@
src: "/var/cache/{{ congress_venv_download_url | basename }}"
dest: "{{ congress_bin | dirname }}"
copy: "no"
- when:
- - not congress_developer_mode | bool
- - congress_get_venv | changed or congress_venv_dir | changed
+ when: congress_get_venv | changed
+ notify:
+ - Restart congress services
- name: Install pip packages
pip:
name: "{{ congress_pip_packages | join(' ') }}"
- state: "{{ congress_package_state }}"
+ state: "{{ congress_pip_package_state }}"
virtualenv: "{{ congress_bin | dirname }}"
virtualenv_site_packages: "no"
+ extra_args: >-
+ {{ congress_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }}
+ {{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
+ {{ pip_install_options | default('') }}
register: install_packages
until: install_packages|success
retries: 5
delay: 2
- when: congress_developer_mode | bool
+ when: congress_get_venv | failed or congress_get_venv | skipped
+ notify:
+ - Restart congress services
+
+- name: Remove python from path first (CentOS, openSUSE)
+ file:
+ path: "{{ congress_bin | dirname }}/bin/python2.7"
+ state: "absent"
+ when:
+ - ansible_pkg_mgr in ['yum', 'dnf', 'zypper']
+ - congress_get_venv | changed
- name: Update virtualenv path
- command: >
- virtualenv-tools --update-path=auto --reinitialize {{ congress_bin | dirname }}
- when:
- - not congress_developer_mode | bool
- - congress_get_venv | changed or congress_venv_dir | changed
+ shell: |
+ find {{ congress_bin }} -name \*.pyc -delete
+ sed -si '1s/^.*python.*$/#!{{ congress_bin | replace ('/','\/') }}\/python/' {{ congress_bin }}/*
+ virtualenv {{ congress_bin | dirname }}
+ when: congress_get_venv | changed
- name: Record the venv tag deployed
ini_file:
@@ -103,6 +123,3 @@
section: congress
option: venv_tag
value: "{{ congress_venv_tag }}"
-
-#- name: Install congress from source
-# command: python /opt/congress/setup.py install
diff --git a/tasks/congress_post_install.yml b/tasks/congress_post_install.yml
index dd60315..c4646d2 100644
--- a/tasks/congress_post_install.yml
+++ b/tasks/congress_post_install.yml
@@ -14,11 +14,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-- name: generate congress configuration
- template:
- src: "{{ item }}"
- dest: "{{ congress_conf_dir }}"
+- name: Deploy configuration files
+ config_template:
+ src: "{{ item.src }}"
+ dest: "{{ item.dest }}"
+ owner: "root"
+ group: "{{ congress_system_group_name }}"
+ mode: "0640"
+ config_overrides: "{{ item.config_overrides }}"
+ config_type: "{{ item.config_type }}"
with_items:
- - api-paste.ini
- - policy.json
- - congress.conf
\ No newline at end of file
+ - src: "api-paste.ini.j2"
+ dest: "{{ congress_etc_dir }}/api-paste.ini"
+ config_overrides: "{{ congress_congress_api_paste_ini_overrides }}"
+ config_type: "ini"
+ - src: "congress.conf.j2"
+ dest: "{{ congress_etc_dir }}/congress.conf"
+ config_overrides: "{{ congress_congress_conf_overrides }}"
+ config_type: "ini"
+ notify:
+ - Restart congress services
diff --git a/tasks/congress_pre_install.yml b/tasks/congress_pre_install.yml
index 163d917..077c357 100644
--- a/tasks/congress_pre_install.yml
+++ b/tasks/congress_pre_install.yml
@@ -14,21 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-- include: congress_apt_packages.yml
-
-- name: install pip packages
- pip:
- name: "{{ item }}"
- with_items:
- - virtualenv
-
-- name: clone congress repo
- git:
- repo: "{{ congress_git_repo }}"
- dest: /opt/congress
- clone: yes
- version: master
-
- name: create congress group
group:
name: "{{ congress_system_group_name }}"
@@ -38,12 +23,47 @@
user:
name: "{{ congress_system_user_name }}"
group: "{{ congress_system_group_name }}"
+ state: present
createhome: no
-- name: make congress configuration directory
+- name: Create congress directories
file:
- path: "{{ item }}"
+ path: "{{ item.path }}"
state: directory
+ owner: "{{ item.owner | default(congress_system_user_name) }}"
+ group: "{{ item.group | default(congress_system_group_name) }}"
+ mode: "{{ item.mode | default('0755') }}"
with_items:
- - /etc/congress
- - /etc/congress/snapshot
+ - path: "/openstack"
+ mode: "0755"
+ owner: "root"
+ group: "root"
+ - path: "{{ congress_etc_dir }}"
+ - path: "{{ congress_etc_dir }}/snapshot"
+ - path: "{{ congress_etc_dir }}/keys"
+ mode: "0755"
+ group: "{{ congress_system_group_name }}"
+ owner: "{{ congress_system_user_name }}"
+ - path: "/var/cache/congress"
+ - path: "{{ congress_system_user_home }}"
+
+- name: test for log directory or link
+ shell: |
+ if [ -h "/var/log/congress" ]; then
+ chown -h {{ congress_system_user_name }}:{{ congress_system_group_name }} "/var/log/congress"
+ chown -R {{ congress_system_user_name }}:{{ congress_system_group_name }} "$(readlink /var/log/congress)"
+ else
+ exit 1
+ fi
+ register: log_dir
+ failed_when: false
+ changed_when: log_dir.rc != 0
+
+- name: Create congress log dir
+ file:
+ path: "/var/log/congress/"
+ state: directory
+ owner: "{{ congress_system_user_name }}"
+ group: "{{ congress_system_group_name }}"
+ mode: "0755"
+ when: log_dir.rc != 0
diff --git a/tasks/congress_service_setup.yml b/tasks/congress_service_setup.yml
index 494d7b4..67b9d7e 100644
--- a/tasks/congress_service_setup.yml
+++ b/tasks/congress_service_setup.yml
@@ -89,5 +89,3 @@
until: add_service|success
retries: 5
delay: 10
- tags:
- - congress-setup
\ No newline at end of file
diff --git a/tasks/main.yml b/tasks/main.yml
index f0850f0..e8e333d 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -14,19 +14,42 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+- name: Gather variables for each operating system
+ include_vars: "{{ item }}"
+ with_first_found:
+ - "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
+ - "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
+ - "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
+ - "{{ ansible_distribution | lower }}.yml"
+ - "{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
+ - "{{ ansible_os_family | lower }}.yml"
+ tags:
+ - always
+
- include: congress_pre_install.yml
+ tags:
+ - congress-install
- include: congress_install.yml
+ tags:
+ - congress-install
- include: congress_post_install.yml
+ tags:
+ - congress-config
-- include: congress_service_setup.yml
- when: >
- inventory_hostname == groups['congress_all'][0]
+- include: "congress_init_{{ ansible_service_mgr }}.yml"
+ tags:
+ - congress-config
- include: congress_db_setup.yml
- when: >
- inventory_hostname == groups['congress_all'][0]
+ when:
+ - "inventory_hostname == ((groups['congress_all']| intersect(ansible_play_hosts)) | list)[0]"
+ tags:
+ - congress-config
-#- name: restart congress
-# command: "{{ congress_bin }}/congress-server --debug"
+- include: congress_service_setup.yml
+ when:
+ - "inventory_hostname == ((groups['congress_all']| intersect(ansible_play_hosts)) | list)[0]"
+ tags:
+ - congress-config
diff --git a/templates/api-paste.ini b/templates/api-paste.ini.j2
similarity index 97%
rename from templates/api-paste.ini
rename to templates/api-paste.ini.j2
index 563f94e..f07e922 100644
--- a/templates/api-paste.ini
+++ b/templates/api-paste.ini.j2
@@ -35,4 +35,4 @@ oslo_config_project = congress
[filter:http_proxy_to_wsgi]
paste.filter_factory = oslo_middleware.http_proxy_to_wsgi:HTTPProxyToWSGI.factory
-oslo_config_project = congress
\ No newline at end of file
+oslo_config_project = congress
diff --git a/templates/congress-systemd-init.j2 b/templates/congress-systemd-init.j2
new file mode 100644
index 0000000..c27cb78
--- /dev/null
+++ b/templates/congress-systemd-init.j2
@@ -0,0 +1,31 @@
+# {{ ansible_managed }}
+
+[Unit]
+Description=congress openstack service
+After=syslog.target
+After=network.target
+
+[Service]
+Type=simple
+User={{ congress_system_user_name }}
+Group={{ congress_system_group_name }}
+
+ExecStart={{ congress_bin }}/{{ congress_program_name }} {{ congress_config_options }}
+ExecReload=/bin/kill -HUP $MAINPID
+
+# Give a reasonable amount of time for the server to start up/shut down
+TimeoutSec=300
+Restart=on-failure
+RestartSec=2
+
+# This creates a specific slice which all services will operate from
+# The accounting options give us the ability to see resource usage through
+# the `systemd-cgtop` command.
+Slice=congress.slice
+CPUAccounting=true
+BlockIOAccounting=true
+MemoryAccounting=false
+TasksAccounting=true
+
+[Install]
+WantedBy=multi-user.target
diff --git a/templates/congress-systemd-tmpfiles.j2 b/templates/congress-systemd-tmpfiles.j2
new file mode 100644
index 0000000..5593f7a
--- /dev/null
+++ b/templates/congress-systemd-tmpfiles.j2
@@ -0,0 +1,4 @@
+# {{ ansible_managed }}
+
+D /var/lock/{{ congress_program_name }} 2755 {{ congress_system_user_name }} {{ congress_system_group_name }}
+D /var/run/{{ congress_program_name }} 2755 {{ congress_system_user_name }} {{ congress_system_group_name }}
diff --git a/templates/congress.conf b/templates/congress.conf.j2
similarity index 77%
rename from templates/congress.conf
rename to templates/congress.conf.j2
index 1e06ce7..f82a90c 100644
--- a/templates/congress.conf
+++ b/templates/congress.conf.j2
@@ -14,7 +14,6 @@
[DEFAULT]
# Print more verbose output (set logging level to INFO instead of default WARNING level).
-verbose = True
# Print debugging output (set logging level to DEBUG instead of default WARNING level).
# debug = False
@@ -33,7 +32,7 @@ verbose = True
# syslog_log_facility = LOG_USER
# use_stderr = True
-log_file = congress.log
+log_file = congress-server.log
log_dir = /var/log/congress
# publish_errors = False
@@ -42,13 +41,19 @@ log_dir = /var/log/congress
bind_host = 0.0.0.0
# Port the bind the API server to
-# bind_port = 1789
+bind_port = "{{ congress_service_port }}"
# The path to the latest policy dump
policy_path = /etc/congress/snapshot
# Paste configuration file
-# api_paste_config = api-paste.ini
+api_paste_config = api-paste.ini
+
+# If set to true, the logging level will be set to DEBUG instead of the default
+# INFO level. (boolean value)
+# Note: This option can be changed without restarting.
+debug = {{ debug | bool }}
+
# The strategy to be used for auth.
# Supported values are 'keystone'(default), 'noauth'.
@@ -57,7 +62,7 @@ auth_strategy = noauth
# List of datasource driver class paths to import.
# For example: congress.datasources.neutronv2_driver.NeutronV2Driver, etc
# errors seen in log, removed congress.datasources.swift_driver.SwiftDriver
-drivers = congress.datasources.neutronv2_driver.NeutronV2Driver,congress.datasources.glancev2_driver.GlanceV2Driver,congress.datasources.nova_driver.NovaDriver,congress.datasources.keystone_driver.KeystoneDriver,congress.datasources.ceilometer_driver.CeilometerDriver,congress.datasources.cinder_driver.CinderDriver,congress.datasources.swift_driver.SwiftDriver
+drivers = congress.datasources.neutronv2_driver.NeutronV2Driver,congress.datasources.glancev2_driver.GlanceV2Driver,congress.datasources.nova_driver.NovaDriver,congress.datasources.keystone_driver.KeystoneDriver,congress.datasources.cinder_driver.CinderDriver,congress.datasources.swift_driver.SwiftDriver
[keystone_authtoken]
auth_host = "{{ keystone_admin_user_name }}"
@@ -68,4 +73,4 @@ admin_user = "{{ congress_service_project_name }}"
admin_password = "{{ congress_service_password }}"
[database]
-connection = "mysql://{{ congress_db_user }}:{{ congress_db_user_password }}@127.0.0.1:{{ congress_service_port }}/congress"
+connection = mysql+pymysql://{{ congress_galera_user }}:{{ congress_container_mysql_password }}@{{ congress_galera_address }}/{{ congress_galera_database }}?charset=utf8{% if congress_galera_use_ssl | bool %}&ssl_ca={{ congress_galera_ssl_ca_cert }}{% endif %}
diff --git a/templates/policy.json b/templates/policy.json
deleted file mode 100644
index 4476051..0000000
--- a/templates/policy.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "context_is_admin": "role:admin",
- "admin_only": "rule:context_is_admin",
- "regular_user": "",
- "default": "rule:admin_only"
-}
diff --git a/test-requirements.txt b/test-requirements.txt
index cbc9fb0..b60679a 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -1 +1,16 @@
-# empty for now
\ No newline at end of file
+# The order of packages is significant, because pip processes them in the order
+# of appearance. Changing the order has an impact on the overall integration
+# process, which may cause wedges in the gate later.
+bashate>=0.5.1 # Apache-2.0
+flake8<2.6.0,>=2.5.4 # MIT
+pyasn1!=0.2.3,>=0.1.8 # BSD
+pyOpenSSL>=16.2.0 # Apache-2.0
+requests>=2.14.2 # Apache-2.0
+ndg-httpsclient>=0.4.2;python_version<'3.0' # BSD
+
+# this is required for the docs build jobs
+sphinx>=1.6.2,!=1.6.6 # BSD
+openstackdocstheme>=1.18.1 # Apache-2.0
+doc8>=0.6.0 # Apache-2.0
+reno>=2.5.0 # Apache-2.0
+sphinxmark>=0.1.14 # Apache-2.0
diff --git a/tests/test-congress-functional.yml b/tests/group_vars/all_containers.yml
similarity index 66%
rename from tests/test-congress-functional.yml
rename to tests/group_vars/all_containers.yml
index 832062f..6d5b77b 100644
--- a/tests/test-congress-functional.yml
+++ b/tests/group_vars/all_containers.yml
@@ -13,16 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-- name: Ensure congress APIs are reachable
- hosts: congress_all
- user: root
- gather_facts: false
- tasks:
- - name: check congress api
- uri:
- url: http://localhost:9800
- status_code: 200
- register: result
- until: result.status == 200
- retries: 5
- delay: 10
+container_name: "{{ inventory_hostname }}"
+container_networks:
+ management_address:
+ address: "{{ ansible_host }}"
+ bridge: "br-mgmt"
+ interface: "eth1"
+ netmask: "255.255.255.0"
+ type: "veth"
+physical_host: localhost
+properties:
+ service_name: "{{ inventory_hostname }}"
diff --git a/tests/host_vars/congress1.yml b/tests/host_vars/congress1.yml
new file mode 100644
index 0000000..ddbf35e
--- /dev/null
+++ b/tests/host_vars/congress1.yml
@@ -0,0 +1,18 @@
+---
+# Copyright 2017, taseer94@gmail.com
+#
+# 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.
+
+ansible_host: 10.1.0.4
+ansible_become: True
+ansible_user: root
diff --git a/tests/host_vars/infra1.yml b/tests/host_vars/infra1.yml
new file mode 100644
index 0000000..86d45ff
--- /dev/null
+++ b/tests/host_vars/infra1.yml
@@ -0,0 +1,18 @@
+---
+# Copyright 2016, 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.
+
+ansible_host: 10.1.0.2
+ansible_become: True
+ansible_user: root
diff --git a/tests/host_vars/localhost.yml b/tests/host_vars/localhost.yml
new file mode 100644
index 0000000..3c5bedb
--- /dev/null
+++ b/tests/host_vars/localhost.yml
@@ -0,0 +1,20 @@
+---
+# Copyright 2017, taseer94@gmail.com
+#
+# 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.
+
+bridges:
+ - name: "br-mgmt"
+ ip_addr: "10.1.0.1"
+
+ansible_python_interpreter: "/usr/bin/python2"
diff --git a/tests/host_vars/openstack1.yml b/tests/host_vars/openstack1.yml
new file mode 100644
index 0000000..1f4bcf0
--- /dev/null
+++ b/tests/host_vars/openstack1.yml
@@ -0,0 +1,18 @@
+---
+# Copyright 2017, taseer94@gmail.com
+#
+# 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.
+
+ansible_host: 10.1.0.3
+ansible_become: True
+ansible_user: root
diff --git a/tests/inventory b/tests/inventory
index 1bd7379..553221a 100644
--- a/tests/inventory
+++ b/tests/inventory
@@ -1,12 +1,17 @@
[all]
localhost
infra1
+openstack1
congress1
[all_containers]
infra1
+openstack1
congress1
+[rabbitmq_all]
+infra1
+
[galera_all]
infra1
@@ -14,17 +19,15 @@ infra1
infra1
[service_all:children]
+rabbitmq_all
galera_all
memcached_all
[keystone_all]
-infra1
-
-[congress_all]
-congress1
+openstack1
[utility_all]
-congress1
+openstack1
[congress_all]
-congress1
\ No newline at end of file
+congress1
diff --git a/tests/os_congress-overrides.yml b/tests/os_congress-overrides.yml
index c92f340..6fd55c7 100644
--- a/tests/os_congress-overrides.yml
+++ b/tests/os_congress-overrides.yml
@@ -13,15 +13,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-congress_service_tenant_name: service
+# Use the tests repo values
congress_rabbitmq_port: "{{ rabbitmq_port }}"
-congress_service_publicuri: "{{ congress_service_proto }}://{{ hostvars[groups['congress_all'][0]]['ansible_host'] }}:{{ congress_service_port }}"
-congress_service_adminurl: "{{ congress_service_proto }}://{{ hostvars[groups['congress_all'][0]]['ansible_host'] }}:{{ congress_service_port }}"
-congress_service_adminuri: "{{ congress_service_proto }}://{{ hostvars[groups['congress_all'][0]]['ansible_host'] }}:{{ congress_service_port }}"
-congress_aodh_enabled: false
-congress_gnocchi_enabled: false
+congress_rabbitmq_servers: "{{ rabbitmq_servers }}"
+congress_rabbitmq_host_group: "{{ rabbitmq_host_group }}"
+congress_rabbitmq_use_ssl: "{{ rabbitmq_use_ssl }}"
+congress_galera_address: "{{ test_galera_host }}"
+
+# Required settings with no defaults
congress_rabbitmq_password: "secrete"
congress_service_password: "secrete"
congress_container_mysql_password: "secrete"
+
+# Force dev mode for the role test
congress_developer_mode: true
-congress_galera_address: "{{ test_galera_host }}"
\ No newline at end of file
+
+# The defaults use to the LB address, so we need to
+# override them to the container address.
+congress_service_publicuri: "{{ congress_service_proto }}://{{ hostvars[groups['congress_all'][0]]['ansible_host'] }}:{{ congress_service_port }}"
+congress_service_internaluri: "{{ congress_service_publicuri }}"
+congress_service_adminuri: "{{ congress_service_publicuri }}"
+
diff --git a/tests/test-intall-congress.yml b/tests/test-install-congress.yml
similarity index 76%
rename from tests/test-intall-congress.yml
rename to tests/test-install-congress.yml
index 02a27a6..5f1f9d0 100644
--- a/tests/test-intall-congress.yml
+++ b/tests/test-install-congress.yml
@@ -20,10 +20,18 @@
gather_facts: true
any_errors_fatal: true
pre_tasks:
+ - include: common/ensure-rabbitmq.yml
+ vhost_name: "{{ congress_rabbitmq_vhost }}"
+ user_name: "{{ congress_rabbitmq_userid }}"
+ user_password: "{{ congress_rabbitmq_password }}"
+ when:
+ - "groups['rabbitmq_all'] is defined"
+
- include: common/create-grant-db.yml
db_name: "{{ congress_galera_database }}"
db_password: "{{ congress_container_mysql_password }}"
+
roles:
- - role: os_congress
+ - role: "os_congress"
vars_files:
- common/test-vars.yml
diff --git a/tests/test.yml b/tests/test.yml
index 2f4916a..fc6bcd5 100644
--- a/tests/test.yml
+++ b/tests/test.yml
@@ -24,6 +24,3 @@
# Install Congress
- include: test-install-congress.yml
-
-# Test Congress
-- include: test-congress-functional.yml
diff --git a/tests/tests-repo-clone.sh b/tests/tests-repo-clone.sh
new file mode 100755
index 0000000..3e4ffd6
--- /dev/null
+++ b/tests/tests-repo-clone.sh
@@ -0,0 +1,117 @@
+#!/bin/bash
+# Copyright 2017, 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.
+
+# PURPOSE:
+# This script clones the openstack-ansible-tests repository to the
+# tests/common folder in order to be able to re-use test components
+# for role testing.
+
+# WARNING:
+# This file is maintained in the openstack-ansible-tests repository:
+# https://git.openstack.org/cgit/openstack/openstack-ansible-tests
+# If you need to change this script, then propose the change there.
+# Once it merges, the change will be replicated to the other repositories.
+
+## Shell Opts ----------------------------------------------------------------
+
+set -e
+
+## Vars ----------------------------------------------------------------------
+
+export TESTING_HOME=${TESTING_HOME:-$HOME}
+export WORKING_DIR=${WORKING_DIR:-$(pwd)}
+export CLONE_UPGRADE_TESTS=${CLONE_UPGRADE_TESTS:-no}
+export ZUUL_TESTS_CLONE_LOCATION="/home/zuul/src/git.openstack.org/openstack/openstack-ansible-tests"
+
+## Functions -----------------------------------------------------------------
+
+function create_tests_clonemap {
+
+# Prepare the clonemap for zuul-cloner to use
+cat > ${TESTING_HOME}/tests-clonemap.yaml << EOF
+clonemap:
+ - name: openstack/openstack-ansible-tests
+ dest: ${WORKING_DIR}/tests/common
+EOF
+
+}
+
+## Main ----------------------------------------------------------------------
+
+# If zuul-cloner is present, use it so that we
+# also include any dependent patches from the
+# tests repo noted in the commit message.
+# We only want to use zuul-cloner if we detect
+# zuul v2 running, so we check for the presence
+# of the ZUUL_REF environment variable.
+# ref: http://git.openstack.org/cgit/openstack-infra/zuul/tree/zuul/ansible/filter/zuul_filters.py?h=feature/zuulv3#n17
+if [[ -x /usr/zuul-env/bin/zuul-cloner ]] && [[ "${ZUUL_REF:-none}" != "none" ]]; then
+
+ # Prepare the clonemap for zuul-cloner to use
+ create_tests_clonemap
+
+ # Execute the clone
+ /usr/zuul-env/bin/zuul-cloner \
+ --cache-dir /opt/git \
+ --map ${TESTING_HOME}/tests-clonemap.yaml \
+ git://git.openstack.org \
+ openstack/openstack-ansible-tests
+
+ # Clean up the clonemap.
+ rm -f ${TESTING_HOME}/tests-clonemap.yaml
+
+# Alternatively, use a simple git-clone. We do
+# not re-clone if the directory exists already
+# to prevent overwriting any local changes which
+# may have been made.
+elif [[ ! -d tests/common ]]; then
+
+ # The tests repo doesn't need a clone, we can just
+ # symlink it. As zuul v3 clones into a folder called
+ # 'workspace' we have to use one of its environment
+ # variables to determine the project name.
+ if [[ "${ZUUL_SHORT_PROJECT_NAME:-none}" == "openstack-ansible-tests" ]] ||\
+ [[ "$(basename ${WORKING_DIR})" == "openstack-ansible-tests" ]]; then
+ ln -s ${WORKING_DIR} ${WORKING_DIR}/tests/common
+
+ # In zuul v3 any dependent repository is placed into
+ # /home/zuul/src/git.openstack.org, so we check to see
+ # if there is a tests checkout there already. If so, we
+ # symlink that and use it.
+ elif [[ -d "${ZUUL_TESTS_CLONE_LOCATION}" ]]; then
+ ln -s "${ZUUL_TESTS_CLONE_LOCATION}" ${WORKING_DIR}/tests/common
+
+ # Otherwise we're clearly not in zuul or using a previously setup
+ # repo in some way, so just clone it from upstream.
+ else
+ git clone \
+ https://git.openstack.org/openstack/openstack-ansible-tests \
+ ${WORKING_DIR}/tests/common
+ fi
+fi
+
+# If this test set includes an upgrade test, the
+# previous stable release tests repo must also be
+# cloned.
+# Note:
+# Dependent patches to the previous stable release
+# tests repo are not supported.
+if [[ "${CLONE_UPGRADE_TESTS}" == "yes" ]]; then
+ if [[ ! -d "${WORKING_DIR}/tests/common/previous" ]]; then
+ git clone -b stable/pike \
+ https://git.openstack.org/openstack/openstack-ansible-tests \
+ ${WORKING_DIR}/tests/common/previous
+ fi
+fi
diff --git a/tox.ini b/tox.ini
index 38a4efd..17077a9 100644
--- a/tox.ini
+++ b/tox.ini
@@ -24,7 +24,7 @@ whitelist_externals =
bash
setenv =
PYTHONUNBUFFERED=1
- ROLE_NAME=os_nova
+ ROLE_NAME=os_congress
TEST_IDEMPOTENCE=false
VIRTUAL_ENV={envdir}
WORKING_DIR={toxinidir}
diff --git a/vars/main.yml b/vars/main.yml
deleted file mode 100644
index 0c222e8..0000000
--- a/vars/main.yml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-# vars file for os_congress
diff --git a/tasks/congress_apt_packages.yml b/vars/ubuntu-16.04.yml
similarity index 66%
rename from tasks/congress_apt_packages.yml
rename to vars/ubuntu-16.04.yml
index e040570..9a44811 100644
--- a/tasks/congress_apt_packages.yml
+++ b/vars/ubuntu-16.04.yml
@@ -14,20 +14,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-- name: install apt packages
- apt:
- name: "{{ item }}"
- with_items:
- - git
- - gcc
- - python-dev
- - python-antlr3
- - libxml2
- - libxslt1-dev
- - libzip-dev
- - build-essential
- - build-essential
- - libssl-dev
- - libffi-dev
- - python-setuptools
- - python-mysqldb
+congress_distro_packages:
+ - git
+ - gcc
+ - python-dev
+ - python-antlr3
+ - libxml2
+ - libxslt1-dev
+ - libzip-dev
+ - build-essential
+ - build-essential
+ - libssl-dev
+ - libffi-dev
+ - python-setuptools
+ - python-mysqldb