]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Re-arrange docker monitor directory for clarity 346/head
authorSébastien Han <seb@redhat.com>
Tue, 28 Jul 2015 13:44:52 +0000 (15:44 +0200)
committerSébastien Han <seb@redhat.com>
Tue, 28 Jul 2015 13:44:52 +0000 (15:44 +0200)
Signed-off-by: Sébastien Han <seb@redhat.com>
roles/ceph-mon/tasks/docker/copy_configs.yml [new file with mode: 0644]
roles/ceph-mon/tasks/docker/fetch_configs.yml [new file with mode: 0644]
roles/ceph-mon/tasks/docker/main.yml [new file with mode: 0644]
roles/ceph-mon/tasks/docker/pre_requisite.yml [new file with mode: 0644]
roles/ceph-mon/tasks/docker/start_docker_monitor.yml [new file with mode: 0644]
roles/ceph-mon/tasks/main.yml

diff --git a/roles/ceph-mon/tasks/docker/copy_configs.yml b/roles/ceph-mon/tasks/docker/copy_configs.yml
new file mode 100644 (file)
index 0000000..74a912b
--- /dev/null
@@ -0,0 +1,10 @@
+---
+- name: push ceph files to the ansible server
+  fetch: >
+    src={{ item.0 }}
+    dest=fetch/docker_mon_files/{{ item.0 }}
+    flat=yes
+  with_together:
+    - ceph_config_keys
+    - statconfig.results
+  when: item.1.stat.exists == false
diff --git a/roles/ceph-mon/tasks/docker/fetch_configs.yml b/roles/ceph-mon/tasks/docker/fetch_configs.yml
new file mode 100644 (file)
index 0000000..71f4b6f
--- /dev/null
@@ -0,0 +1,31 @@
+---
+- name: set config and keys paths
+  set_fact:
+    ceph_config_keys:
+      - /etc/ceph/ceph.client.admin.keyring
+      - /etc/ceph/ceph.conf
+      - /etc/ceph/monmap
+      - /etc/ceph/ceph.mon.keyring
+      - /var/lib/ceph/bootstrap-osd/ceph.keyring
+      - /var/lib/ceph/bootstrap-rgw/ceph.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-mon/tasks/docker/main.yml b/roles/ceph-mon/tasks/docker/main.yml
new file mode 100644 (file)
index 0000000..e7ae9d4
--- /dev/null
@@ -0,0 +1,5 @@
+---
+- include: pre_requisite.yml
+- include: fetch_configs.yml
+- include: start_docker_monitor.yml
+- include: copy_configs.yml
diff --git a/roles/ceph-mon/tasks/docker/pre_requisite.yml b/roles/ceph-mon/tasks/docker/pre_requisite.yml
new file mode 100644 (file)
index 0000000..409511f
--- /dev/null
@@ -0,0 +1,15 @@
+---
+- name: create bootstrap directories
+  file: >
+    path=/var/lib/ceph/bootstrap-{{ item }}
+    state=directory
+  with_items:
+    - osd
+    - mds
+    - rgw
+
+# 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-mon/tasks/docker/start_docker_monitor.yml b/roles/ceph-mon/tasks/docker/start_docker_monitor.yml
new file mode 100644 (file)
index 0000000..d31bc81
--- /dev/null
@@ -0,0 +1,9 @@
+---
+- name: run the ceph Monitor docker image
+  docker: >
+    image="{{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}"
+    name="{{ ansible_hostname }}"
+    net="host"
+    state="running"
+    env="MON_IP={{ hostvars[inventory_hostname]['ansible_' + ceph_mon_docker_interface]['ipv4']['address'] }},CEPH_DAEMON=MON,CEPH_PUBLIC_NETWORK={{ ceph_mon_docker_subnet }},{{ ceph_mon_extra_envs }}"
+    volumes="/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph"
index a1c450299c553fff38da761651b5559b0f0c52d6..1000514347ee9b52fe9b1d98e54caa6cc025c5e7 100644 (file)
@@ -18,5 +18,5 @@
     secure_cluster and
     not ceph_containerized_deployment
 
-- include: docker.yml
+- include: ./docker/main.yml
   when: ceph_containerized_deployment