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

index 9f6c9a616723dad552239d7537115b46eacf3f9e..15ff7150cb5c8c163a04dd057bcade194717f8a8 100644 (file)
@@ -28,3 +28,4 @@ dummy:
 #ceph_rgw_docker_username: ceph\r
 #ceph_rgw_docker_imagename: daemon\r
 #ceph_rgw_civetweb_port: 80\r
+#ceph_rgw_docker_extra_env: "RGW_CIVETWEB_PORT={{ ceph_rgw_civetweb_port }}" # comma separated variables\r
diff --git a/roles/ceph-mds/tasks/docker.yml b/roles/ceph-mds/tasks/docker.yml
deleted file mode 100644 (file)
index 2707c4e..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
----
-- 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-mds/ceph.keyring
-
-# NOTE (leseb): force 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
-
-- name: stat for ceph config and keys
-  stat: >
-    path={{ item }}
-  with_items: ceph_config_keys
-  ignore_errors: true
-  register: statconfig
-
-- name: try to fetch ceph config and keys
-  copy: >
-    src=fetch/docker_mon_files/"{{ item }}"
-    dest=/etc/ceph/
-    owner=root
-    group=root
-    mode=600
-  with_together:
-    - ceph_config_keys
-    - statconfig.results
-  when: item.1.stat.exists == true
-
-- 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="CEPH_DAEMON=MDS,CEPHFS_CREATE=1"
-    volumes="/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph"
-
-- name: ensure ceph_mds service is running
-  docker: >
-    image="{{ ceph_mds_docker_username }}/{{ ceph_mds_docker_imagename }}"
-    name="ceph-{{ ansible_hostname }}-mds"
-    state=running
index 6bb65fe4f8df0383de4e9fb1012bf324ab355e2b..1046e481e99899fadadf0635cbb611f5d2d42869 100644 (file)
@@ -28,3 +28,4 @@ ceph_containerized_deployment: false
 ceph_rgw_civetweb_port: 80\r
 ceph_rgw_docker_username: ceph\r
 ceph_rgw_docker_imagename: daemon\r
+ceph_rgw_docker_extra_env: "RGW_CIVETWEB_PORT={{ ceph_rgw_civetweb_port }}" # comma separated variables\r
diff --git a/roles/ceph-rgw/tasks/docker.yml b/roles/ceph-rgw/tasks/docker.yml
deleted file mode 100644 (file)
index 6445b74..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
----
-- 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-rgw/ceph.keyring
-
-# NOTE (leseb): force 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
-
-- name: stat for ceph config and keys
-  stat: >
-    path={{ item }}
-  with_items: ceph_config_keys
-  ignore_errors: true
-  register: statconfig
-
-- name: try to fetch ceph config and keys
-  copy: >
-    src=fetch/docker_mon_files/"{{ item }}"
-    dest=/etc/ceph/
-    owner=root
-    group=root
-    mode=600
-  with_together:
-    - ceph_config_keys
-    - statconfig.results
-  when: item.1.stat.exists == true
-
-- name: run the rados gateway docker image
-  docker: >
-    image="{{ ceph_rgw_docker_username }}/{{ ceph_rgw_docker_imagename }}"
-    name=ceph-{{ ansible_hostname }}-rgw
-    expose={{ ceph_rgw_civetweb_port }}
-    state=running
-    env="RGW_CIVETWEB_PORT={{ ceph_rgw_civetweb_port }},CEPH_DAEMON=RGW"
-    volumes="/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph"
-
-- name: ensure ceph_rgw service is running
-  docker: >
-    image="{{ ceph_rgw_docker_username }}/{{ ceph_rgw_docker_imagename }}"
-    name="ceph-{{ ansible_hostname }}-rgw"
-    detach=yes
-    state=running
diff --git a/roles/ceph-rgw/tasks/docker/fetch_configs.yml b/roles/ceph-rgw/tasks/docker/fetch_configs.yml
new file mode 100644 (file)
index 0000000..a7ffd9b
--- /dev/null
@@ -0,0 +1,26 @@
+---
+- name: set config and keys paths
+  set_fact:
+    ceph_config_keys:
+      - /etc/ceph/ceph.conf
+      - /var/lib/ceph/bootstrap-rgw/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-rgw/tasks/docker/main.yml b/roles/ceph-rgw/tasks/docker/main.yml
new file mode 100644 (file)
index 0000000..43676be
--- /dev/null
@@ -0,0 +1,4 @@
+---
+- include: pre_requisite.yml
+- include: fetch_configs.yml
+- include: start_docker_rgw.yml
diff --git a/roles/ceph-rgw/tasks/docker/pre_requisite.yml b/roles/ceph-rgw/tasks/docker/pre_requisite.yml
new file mode 100644 (file)
index 0000000..99704d7
--- /dev/null
@@ -0,0 +1,11 @@
+---
+- name: create rgw bootstrap directory
+  file: >
+    path=/var/lib/ceph/bootstrap-rgw
+    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-rgw/tasks/docker/start_docker_rgw.yml b/roles/ceph-rgw/tasks/docker/start_docker_rgw.yml
new file mode 100644 (file)
index 0000000..d39e9f6
--- /dev/null
@@ -0,0 +1,9 @@
+---
+- name: run the rados gateway docker image
+  docker: >
+    image="{{ ceph_rgw_docker_username }}/{{ ceph_rgw_docker_imagename }}"
+    name=ceph-{{ ansible_hostname }}-rgw
+    expose={{ ceph_rgw_civetweb_port }}
+    state=running
+    env="CEPH_DAEMON=RGW,{{ ceph_rgw_docker_extra_env }}"
+    volumes="/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph"
index 0ce9168c720590a47fa2e719b335ff0a7803cae9..04d1bf8d361c77287e925a28756d7e2108088784 100644 (file)
@@ -37,5 +37,5 @@
 - include: start_radosgw.yml
   when: not ceph_containerized_deployment
 
-- include: docker.yml
+- include: ./docker/main.yml
   when: ceph_containerized_deployment