Re-arrange docker invocation and fix bootstrap

Signed-off-by: Sébastien Han <seb@redhat.com>
pull/347/head
Sébastien Han 2015-07-28 16:05:35 +02:00
parent 8d323742c7
commit 6d0e8777e2
7 changed files with 59 additions and 4 deletions

View File

@ -114,5 +114,6 @@ osd_crush_location: "'root={{ ceph_crush_root }} rack={{ ceph_crush_rack }} host
#ceph_containerized_deployment: false #ceph_containerized_deployment: false
#ceph_osd_docker_username: ceph #ceph_osd_docker_username: ceph
#ceph_osd_docker_imagename: daemon #ceph_osd_docker_imagename: daemon
#ceph_osd_docker_devices: #ceph_osd_docker_extra_env: "CEPH_DAEMON=OSD_CEPH_DISK" # comma separated variables
# - /dev/sdb #ceph_osd_docker_device:
# - /dev/sdb

View File

@ -109,4 +109,6 @@ osd_directory: false
ceph_containerized_deployment: false ceph_containerized_deployment: false
ceph_osd_docker_username: ceph ceph_osd_docker_username: ceph
ceph_osd_docker_imagename: daemon ceph_osd_docker_imagename: daemon
#ceph_osd_docker_device: /dev/sdb ceph_osd_docker_extra_env: "CEPH_DAEMON=OSD_CEPH_DISK" # comma separated variables
#ceph_osd_docker_device:
# - /dev/sdb

View File

@ -0,0 +1,26 @@
---
- name: set config and keys paths
set_fact:
ceph_config_keys:
- /etc/ceph/ceph.conf
- /var/lib/ceph/bootstrap-osd/ceph.keyring
- name: stat for ceph config and keys
local_action: stat path={{ item }}
with_items: ceph_config_keys
changed_when: false
sudo: false
ignore_errors: true
register: statconfig
- name: try to fetch ceph config and keys
copy: >
src=fetch/docker_mon_files/{{ item.0 }}
dest={{ item.0 }}
owner=root
group=root
mode=644
with_together:
- ceph_config_keys
- statconfig.results
when: item.1.stat.exists == true

View File

@ -0,0 +1,4 @@
---
- include: pre_requisite.yml
- include: fetch_configs.yml
- include: start_docker_osd.yml

View File

@ -0,0 +1,11 @@
---
- name: create osd bootstrap directory
file: >
path=/var/lib/ceph/bootstrap-osd
state=directory
# NOTE (leseb): for version 1.1.0 because https://github.com/ansible/ansible-modules-core/issues/1227
- name: install docker-py
pip: >
name=docker-py
version=1.1.0

View File

@ -0,0 +1,11 @@
---
- name: run the ceph osd docker image
docker: >
image="{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}"
name={{ ansible_hostname }}-osd-{{ item | regex_replace('/', '') }}
net=host
state=running
privileged=yes
env="OSD_DEVICE={{ item }},{{ ceph_osd_docker_extra_env }}"
volumes="/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/dev/:/dev/"
with_items: ceph_osd_docker_devices

View File

@ -12,5 +12,5 @@
- include: ./scenarios/osd_directory.yml - include: ./scenarios/osd_directory.yml
when: osd_directory and not ceph_containerized_deployment when: osd_directory and not ceph_containerized_deployment
- include: ./scenarios/docker.yml - include: ./docker/main.yml
when: ceph_containerized_deployment when: ceph_containerized_deployment