Prepare for role integration

In order to integrate this role with OpenStack-Ansible there needs
to be using standard CONTRIBUTING.rst and README.rst and the same
.gitignore and .gitreview and setup.* pattern as other roles.

Finally an other-requirements.txt, test-requirements.txt and a
tox.ini are introduced as the basis for docs building and testing in
openstack infra.
This commit is contained in:
Steve Lewis 2016-04-04 15:17:04 -07:00
parent d1bb929d12
commit b5282439bd
10 changed files with 361 additions and 224 deletions

63
.gitignore vendored Normal file
View File

@ -0,0 +1,63 @@
# 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

4
.gitreview Normal file
View File

@ -0,0 +1,4 @@
[gerrit]
host=review.openstack.org
port=29418
project=openstack/openstack-ansible-os_gnocchi.git

View File

@ -1,117 +1,85 @@
OpenStack Gnocchi
=====================
os_gnocchi
#######
:tags: openstack, cloud, ansible
:category: \*nix
Contributor Code of Conduct
---------------------------
As contributors and maintainers of this project, we pledge to respect all
people who contribute through reporting issues, posting feature requests,
updating documentation, submitting pull requests or patches, and other
activities.
We are committed to making participation in this project a harassment-free
experience for everyone, regardless of level of experience, gender, gender
identity and expression, sexual orientation, disability, personal appearance,
body size, race, ethnicity, age, or religion.
Examples of unacceptable behavior by participants include the use of sexual
language or imagery, derogatory comments or personal attacks, trolling, public
or private harassment, insults, or other unprofessional conduct.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct. Project maintainers who do not
follow the Code of Conduct may be removed from the project team.
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by opening an issue or contacting one or more of the project
maintainers.
This Code of Conduct is adapted from the `Contributor Covenant`_, version
1.0.0, available at http://contributor-covenant.org/version/1/0/0/
.. _Contributor Covenant: http://contributor-covenant.org
..
Re-formatted to reStructuredText from
https://raw.githubusercontent.com/CoralineAda/contributor_covenant/master/CODE_OF_CONDUCT.md
Contributor Guidelines
----------------------
contributor guidelines
^^^^^^^^^^^^^^^^^^^^^^
Filing Bugs
~~~~~~~~~~~
-----------
Bugs should be filed on Launchpad, not GitHub: "https://bugs.launchpad.net/openstack-ansible"
Bugs should be filed on the `GitHub project page
<https://github.com/stevelle/openstack-ansible-gnocchi/issues>`_.
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.
* 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 this project should be sent via `pull request
<https://github.com/stevelle/openstack-ansible-gnocchi/pulls>`_ on
GitHub.
Changes to the project should be submitted for review via the Gerrit tool, following
the workflow documented at: "http://docs.openstack.org/infra/manual/developers.html#development-workflow"
Pull requests submitted through GitHub will be ignored and closed without regard.
Extra
-----
Tags:
If it's a bug that needs fixing in a branch in addition to Master, add a '\<release\>-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.
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
.. code-block:: yaml
- name: The name of the tasks
module_name:
thing1: "some-stuff"
thing2: "some-other-stuff"
tags:
- some-tag
- some-other-tag
- 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:
Example **NOT** in YAML dictionary format:
.. code-block:: yaml
.. code-block:: yaml
- name: The name of the tasks
module_name: thing1="some-stuff" thing2="some-other-stuff"
tags:
- some-tag
- some-other-tag
- 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.
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.
------
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.

View File

@ -1,4 +1,4 @@
Apache License
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

View File

@ -1,138 +1,15 @@
OpenStack-Ansible Gnocchi
=========================
os_gnocchi role
############
:tags: openstack, cloud, ansible, os_gnocchi
:category: \*nix
A simple role to deploy `OpenStack Gnocchi <http://gnocchi.xyz/>`_
from source in a manner similar to the OpenStack-Ansible project.
Project Status
--------------
Currently the role is expected to deploy and run a gnocchi service
appropriately. Integration with Ceilometer is in development and should be
considered experimental at this time.
Requirements
------------
Index
^^^^^
You will need to have an appropriate SQLAlchemy-supported database for the
index. OpenStack-Ansible provides roles to deploy a Galera cluster, and
this role is presumed by the default indexer url but you can override that
using the config template library if you wish to use PostgreSQL.
Storage
^^^^^^^
You will need to have an appropriate set of data stores. Filesystem storage
is an option but is NOT an H.A. solution and will not work properly if there
are multiple Gnocchi instances in your OpenStack cluster. First-class support
is planned for Swift is in testing and is the current default. support for
Ceph as a storage engine is theoretically possible but has not been tested yet.
Coordination
^^^^^^^^^^^^
The default is to use file-based coordination so the default is NOT an H.A.
solution and will not work properly if there are multiple Gnocchi instances in
a your OpenStack cluster.
If you wish to use Etcd, Redis, or Zookeeper for coordination, setting up that
service is a prerequisite. You might have luck using other roles for
management of that. (e.g. https://github.com/AnsibleShipyard/ansible-java and
https://github.com/AnsibleShipyard/ansible-zookeeper)
Secrets
^^^^^^^
The secrets file (which should be copied to ``/etc/openstack_deploy`` in your
deploy but originating from ``ext/openstack_deploy/user_gnocchi_secrets.yml``)
needs to have values specified. This can be done by invoking the generator
found in the openstack-ansible project: ``scripts/pw-token-gen.py``
TODO
^^^^
- Resynchronize patterns from OpenStack-Ansible.
- Collect the TODO tasks that are hidden throughout the project.
- Write proper docs for this role.
Role Variables
--------------
The variables which need to be provided will vary based on the storage chosen.
The default storage is Swift. If you wish to use another storage option you
will need to provide the appropriate overrides (specified in
gnocchi_conf_overrides found defaults/main.yml and see also
ext/openstack_deploy/openstack_gnocchi_overrides.yml.example for how to use
this).
Other variables expected for this role include:
- keystone_auth_admin_token
- keystone_service_internaluri
- keystone_service_internaluri_insecure
- keystone_service_adminruri
- keystone_service_adminruri_insecure
- galera_address
- galera_root_user
- galera_root_password
- memcached_servers
- memcached_encryption_key
- internal_lb_vip_address
- external_lb_vip_address
The ``keystone_auth_admin_token`` should contain the Keystone admin auth
token which can be used to bypass traditional Keystone auth and is used to
create service users/roles/endpoints as needed within Keystone.
Each of the ``keystone_service_*uri`` variables is expected to include
protocol, host, and port for the keystone service. Do not specify a path, to
include keystone protocol version. See also the OpenStack-Ansible project and
the os_keystone role for more details on these variables.
Each ``keystone_*_insecure`` variable is expected to indicate whether or not
Keystone is using the http protocol or not, and should evaluate to a boolean.
The ``galera_address`` is expected to direct to the your MySQL server or a load
balancer host which sits in front of your Galera cluster. This may be See also
the OpenStack-Ansible project for more details. The ``galera_root_*`` variables
should contain the credentials used to create the Gnocchi index database.
The ``memcached_*`` variables are expected for caching Keystone auth. See also
the OpenStack-Ansible project and the os_keystone role for more details on
these variables.
Each of the ``*_lb_vip_address`` variables is expected to contain the host
address for your Gnocchi service, either internal address for use within the
OpenStack cluster's local network or external for constructing the public
Gnocchi API service endpoint. Either one might point to your load-balancer.
Note that both of these variables are likely to be renamed.
See ``defaults/main.yml`` for additional variables and their descriptions.
Dependencies
------------
TBD
Example Playbook
----------------
os_gnocchi Role
.. code-block:: yaml
- hosts: gnocchi_all
- name: os_gnocchi role
hosts: "hosts"
user: root
roles:
role: stevelle.openstack-ansible-gnocchi
galera_address: "{{ internal_lb_vip_address }}"
tags:
- "os-gnocchi"
- { role: "os_gnocchi" }
License
-------
Apache
Credits
-------
The ``config_template`` library module was developed by Kevin Carter for the
OpenStack-Ansible and is vendored in ``library``.
The role layout and documentation was cribbed from the Openstack Searchlight
role by Ian Cordasco.

17
other-requirements.txt Normal file
View File

@ -0,0 +1,17 @@
# 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.
# OpenStack-CI's Jenkins needs curl
# TODO(odyssey4me) remove this once https://review.openstack.org/288634 has merged
# and the disk images are rebuilt and redeployed.
curl

25
setup.cfg Normal file
View File

@ -0,0 +1,25 @@
[metadata]
name = openstack-ansible-os_gnocchi
summary = os_gnocchi 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

23
setup.py Normal file
View File

@ -0,0 +1,23 @@
#!/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)

9
test-requirements.txt Normal file
View File

@ -0,0 +1,9 @@
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

151
tox.ini Normal file
View File

@ -0,0 +1,151 @@
[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
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=
echo -e "\n *******************************************************\n" \
"**** docs build is still to be implemented ****\n" \
"**** TODO: Make these pass ****\n" \
"*******************************************************\n"
# 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
echo -e "\n *******************************************************\n" \
"**** pep8 testing is still to be implemented ****\n" \
"**** TODO: Make these pass ****\n" \
"*******************************************************\n"
# 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)
echo -e "\n *******************************************************\n" \
"**** Bashate Testing is still to be implemented ****\n" \
"**** TODO: Make these pass ****\n" \
"*******************************************************\n"
# 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 =
echo -e "\n *******************************************************\n" \
"**** Syntax Testing is still to be implemented ****\n" \
"**** TODO: Make these pass ****\n" \
"*******************************************************\n"
# 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 =
echo -e "\n *******************************************************\n" \
"**** Syntax Testing is still to be implemented ****\n" \
"**** TODO: Make these pass ****\n" \
"*******************************************************\n"
# 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"
# 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 \
# -e "rolename={toxinidir}" \
# -vv \
# {toxinidir}/tests/test.yml
[testenv:linters]
commands =
{[testenv:pep8]commands}
{[testenv:bashate]commands}
{[testenv:ansible-lint]commands}
{[testenv:ansible-syntax]commands}