Merge pull request #232 from leseb/ceph-rest-api

Implement Ceph REST API
pull/234/head
Leseb 2015-03-23 18:55:24 +01:00
commit 72e1050bae
8 changed files with 82 additions and 0 deletions

View File

@ -111,6 +111,13 @@ dummy:
#radosgw: false # referenced in monitor role too.
#radosgw_dns_name: your.subdomain.tld # subdomains used by radosgw. See http://ceph.com/docs/master/radosgw/config/#enabling-subdomain-s3-calls
## REST API options
#
#restapi: false # disable restapi configuration in ceph.conf
#restapi_public_addr: 0.0.0.0:5000
#restapi_base_url: /api/v0.1
#restapi_log_level: warning
## Testing mode
# enable this mode _only_ when you have a single node
# if you don't want it keep the option commented

View File

@ -128,6 +128,14 @@ radosgw: false # referenced in monitor role too.
radosgw_frontend: civetweb # supported options are 'apache' or 'civetweb', also edit roles/ceph-radosgw/defaults/main.yml
radosgw_civetweb_port: 80
## REST API options
#
restapi: false # disable restapi configuration in ceph.conf
restapi_interface: eth1
restapi_port: 5000
restapi_base_url: /api/v0.1
restapi_log_level: warning # available level are: critical, error, warning, info, debug
## Testing mode
# enable this mode _only_ when you have a single node
# if you don't want it keep the option commented

View File

@ -152,3 +152,12 @@
{% endif %}
{% endfor %}
{% endif %}
{% if restapi %}
[client.restapi]
public addr = {{ hostvars[inventory_hostname]['ansible_' + restapi_interface]['ipv4']['address'] }}:{{ restapi_port }}
restapi base url = {{ restapi_base_url }}
restapi log level = {{ restapi_log_level }}
keyring = /var/lib/ceph/restapi/ceph-restapi/keyring
log file = /var/log/ceph/ceph-restapi.log
{% endif %}

View File

@ -20,6 +20,11 @@ cephfs_data: cephfs_data
cephfs_metadata: cephfs_metadata
cephfs: cephfs
# Ceph REST API
# referenced in common role too.
restapi: false
#############
# OPENSTACK #
#############

View File

@ -13,6 +13,13 @@
with_items: groups.rgws
changed_when: False
- name: Create Ceph REST API keyring
command: >
ceph auth get-or-create client.restapi osd 'allow *' mon 'allow *' -o /etc/ceph/ceph.client.restapi.keyring
creates=/etc/ceph/ceph.client.restapi.keyring
when: cephx and restapi
changed_when: False
- include: openstack_config.yml
when: openstack_config and cephx
@ -21,6 +28,15 @@
register: ceph_keys
when: cephx
- name: Set keys permissions
file: >
path={{ item }}
mode=0600
owner=root
group=root
with_items:
- "{{ ceph_keys.stdout_lines }}"
- name: Copy keys to the ansible server
fetch: >
src={{ item }}

View File

@ -0,0 +1,11 @@
---
- include: pre_requisite.yml
- name: Check if Ceph REST API is already started
shell: "ps aux|grep [c]eph-rest-api"
register: restapi_status
ignore_errors: True
- name: Start Ceph REST API
shell: "nohup ceph-rest-api -n client.restapi &"
when: restapi_status.rc != 0

View File

@ -0,0 +1,25 @@
---
- name: Create Ceph REST API directory
file: >
path=/var/lib/ceph/restapi/ceph-restapi
state=directory
owner=root
group=root
mode=0644
- name: Copy Ceph REST API keyring
copy: >
src=fetch/{{ fsid }}/etc/ceph/ceph.client.restapi.keyring
dest=/var/lib/ceph/restapi/ceph-restapi/keyring
owner=root
group=root
mode=600
when: cephx
- name: Activate Ceph REST API with upstart
file: >
path=/var/lib/ceph/restapi/ceph-restapi/done
state=touch
owner=root
group=root
mode=0644

View File

@ -14,6 +14,7 @@
sudo: True
roles:
- ceph-mon
- ceph-restapi
- hosts: osds
sudo: True