]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Re-arrange docker invocation and fix bootstrap mds 349/head
authorSébastien Han <seb@redhat.com>
Tue, 28 Jul 2015 15:15:19 +0000 (17:15 +0200)
committerSébastien Han <seb@redhat.com>
Tue, 28 Jul 2015 15:25:53 +0000 (17:25 +0200)
Signed-off-by: Sébastien Han <seb@redhat.com>
group_vars/mdss.sample
roles/ceph-mds/defaults/main.yml
roles/ceph-mds/tasks/docker/fetch_configs.yml [new file with mode: 0644]
roles/ceph-mds/tasks/docker/main.yml [new file with mode: 0644]
roles/ceph-mds/tasks/docker/pre_requisite.yml [new file with mode: 0644]
roles/ceph-mds/tasks/docker/start_docker_mds.yml [new file with mode: 0644]
roles/ceph-mds/tasks/main.yml

index 22fa5722ec12cc61719b5db992617970da5a589d..031ece6baf110deb799111360a62b5b416429683 100644 (file)
@@ -11,3 +11,4 @@ dummy:
 #ceph_containerized_deployment: false\r
 #ceph_mds_docker_username: ceph\r
 #ceph_mds_docker_imagename: daemon\r
+#ceph_mds_docker_extra_envs: "MDS_NAME={{ ansible_hostname }}" # comma separated variables\r
index fc5abef356d7f99c93fd8eb234a93dfdd1280afe..c4de31f682dc95036877e8105810958f0c713b8f 100644 (file)
@@ -11,3 +11,4 @@ cephx: true
 ceph_containerized_deployment: false\r
 ceph_mds_docker_username: ceph\r
 ceph_mds_docker_imagename: daemon\r
+ceph_mds_docker_extra_envs: "MDS_NAME={{ ansible_hostname }}" # comma separated variables\r
diff --git a/roles/ceph-mds/tasks/docker/fetch_configs.yml b/roles/ceph-mds/tasks/docker/fetch_configs.yml
new file mode 100644 (file)
index 0000000..06c5693
--- /dev/null
@@ -0,0 +1,29 @@
+---
+# NOTE (leseb): the mds container needs the admin key
+# so it can create the mds pools for cephfs
+- name: set config and keys paths
+  set_fact:
+    ceph_config_keys:
+      - /etc/ceph/ceph.conf
+      - /etc/ceph/ceph.client.admin.keyring
+      - /var/lib/ceph/bootstrap-mds/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
diff --git a/roles/ceph-mds/tasks/docker/main.yml b/roles/ceph-mds/tasks/docker/main.yml
new file mode 100644 (file)
index 0000000..0b859c2
--- /dev/null
@@ -0,0 +1,4 @@
+---
+- include: pre_requisite.yml
+- include: fetch_configs.yml
+- include: start_docker_mds.yml
diff --git a/roles/ceph-mds/tasks/docker/pre_requisite.yml b/roles/ceph-mds/tasks/docker/pre_requisite.yml
new file mode 100644 (file)
index 0000000..5ba88d8
--- /dev/null
@@ -0,0 +1,11 @@
+---
+- name: create mds bootstrap directory
+  file: >
+    path=/var/lib/ceph/bootstrap-mds
+    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
diff --git a/roles/ceph-mds/tasks/docker/start_docker_mds.yml b/roles/ceph-mds/tasks/docker/start_docker_mds.yml
new file mode 100644 (file)
index 0000000..dc9e167
--- /dev/null
@@ -0,0 +1,9 @@
+---
+- name: run the ceph medata docker image
+  docker: >
+    image="{{ ceph_mds_docker_username }}/{{ ceph_mds_docker_imagename }}"
+    name=ceph-{{ ansible_hostname }}-mds
+    net=host
+    state=running
+    env="CEPHFS_CREATE=1,{{ ceph_osd_docker_extra_env }}"
+    volumes="/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph"
index fcdbce94e016c272ebb317239154182a25fb0f20..40a43dd0994c7fbc1170521e6a88854c96cce1e7 100644 (file)
@@ -2,5 +2,5 @@
 - include: pre_requisite.yml
   when: not ceph_containerized_deployment
 
-- include: docker.yml
+- include: ./docker/main.yml
   when: ceph_containerized_deployment