Skip to content

Commit

Permalink
Merge pull request #18 from FujitsuEnablingSoftwareTechnologyGmbH/master
Browse files Browse the repository at this point in the history
Redhat Support for Monasca-Keystone
  • Loading branch information
Roland Hochmuth committed Sep 22, 2015
2 parents 0ea5f28 + ad3d462 commit 2ec07cd
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 7 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@ does not support a `cacert` parameter so it is not used.

##Optional

### Keystone service endpoints
By default only single service endpoint is registered in Keystone. List of
endpoints is held under `keystone_service_endpoints` variable. For adding new
ones this variable has to be overridden. An example below illustrates how it
should be defined:

```yml
keystone_service_endpoints:
- {name: "monasca", description: "Monasca monitoring service", type: "monitoring", url: "{{ monasca_api_url }}"}
```
Each entry must have following variables defined:
- `name`,
- `description`,
- `type`,
- `url`

##License
Apache

Expand Down
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
# ©Copyright 2015 Hewlett-Packard Development Company, L.P.
# Copyright 2015 FUJITSU LIMITED

keystone_url: http://127.0.0.1:35357/v2.0
keystone_region: RegionOne
Expand All @@ -13,3 +14,6 @@ keystone_service_script: /usr/local/bin/create_monasca_service.py
monasca_api_url: http://localhost:8070/v2.0
monasca_virtualenv_dir: /opt/monasca
skip_install: False

keystone_service_endpoints:
- {name: "monasca", description: "Monasca monitoring service", type: "monitoring", url: "{{ monasca_api_url }}"}
7 changes: 7 additions & 0 deletions tasks/DebianInst.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# Copyright 2015 FUJITSU LIMITED

- name: Install deps to avoid pip doing compilation or enable it
apt: name="{{ item }}" state=present
with_items:
- "{{ dependencies }}"
13 changes: 13 additions & 0 deletions tasks/RedHatInst.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
# Copyright 2015 FUJITSU LIMITED

- name: Install deps to avoid pip doing compilation or enable it
yum: name={{item}} state=present
with_items:
- "{{ dependencies }}"

- name: Virtualenv from pypi
pip: name=virtualenv extra_args='--upgrade' state=present

- name: Setuptools from pypi
pip: name=setuptools extra_args='--upgrade' state=present virtualenv="{{ monasca_virtualenv_dir }}"
17 changes: 13 additions & 4 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
---
# ©Copyright 2015 Hewlett-Packard Development Company, L.P.
# Copyright 2015 FUJITSU LIMITED

- name: Install deps to avoid pip doing compilation or enable it
apt: name={{item}} state=present
with_items: dependencies
when: not skip_install
- name: Gather OS Specific Variables
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
- "defaults.yml"

- include: DebianInst.yml
when: ansible_os_family == 'Debian' and not skip_install
- include: RedHatInst.yml
when: ansible_os_family == 'RedHat' and not skip_install

- name: Keystone User - Install dependencies
pip: name=python-keystoneclient state=present virtualenv="{{monasca_virtualenv_dir}}"
Expand Down
9 changes: 6 additions & 3 deletions templates/create_monasca_service.py.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
# Copyright 2015 FUJITSU LIMITED

from __future__ import print_function
from keystoneclient.v2_0 import client
Expand Down Expand Up @@ -176,10 +177,12 @@ def main():
if not add_user_roles(key, users):
return 1

if add_service_endpoint(key, 'monasca', 'Monasca monitoring service', 'monitoring', '{{ monasca_api_url }}', '{{ keystone_region }}'):
return 0
else:
{% for endpoint in keystone_service_endpoints %}
if not add_service_endpoint(key, '{{ endpoint.name }}', '{{ endpoint.description }}', '{{ endpoint.type }}', '{{ endpoint.url }}', '{{ keystone_region }}'):
return 1
{% endfor %}

return 0


if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions vars/main.yml → vars/Debian.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
# ©Copyright 2015 Hewlett-Packard Development Company, L.P.
# Copyright 2015 FUJITSU LIMITED

dependencies:
- python-dev
5 changes: 5 additions & 0 deletions vars/RedHat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
# Copyright 2015 FUJITSU LIMITED

dependencies:
- python-devel

0 comments on commit 2ec07cd

Please sign in to comment.