From d7d83273e71bff211d01efa90bbc3a3e7c57e0b8 Mon Sep 17 00:00:00 2001 From: pprokop Date: Wed, 30 Mar 2016 12:22:15 +0200 Subject: [PATCH 1/4] Adding support for non atomic and non CoreOS machines for deploying containerized osds with kv backend --- roles/ceph-osd/tasks/docker/start_docker_osd.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/roles/ceph-osd/tasks/docker/start_docker_osd.yml b/roles/ceph-osd/tasks/docker/start_docker_osd.yml index ff59f6360..b4b29f325 100644 --- a/roles/ceph-osd/tasks/docker/start_docker_osd.yml +++ b/roles/ceph-osd/tasks/docker/start_docker_osd.yml @@ -91,3 +91,19 @@ volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/dev/:/dev/" with_items: ceph_osd_docker_devices when: not is_atomic and ansible_os_family != 'CoreOS' + and not osd_containerized_deployment_with_kv + + +- name: run the ceph osd docker image with kv + docker: + image: "{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}" + name: "{{ ansible_hostname }}-osd-{{ item | regex_replace('/', '') }}" + net: host + pid: host + state: running + privileged: yes + env: "KV_TYPE={{kv_type}},KV_IP={{kv_endpoint}},OSD_DEVICE={{ item }},{{ ceph_osd_docker_extra_env }}" + volumes: "/dev/:/dev/" + with_items: ceph_osd_docker_devices + when: not is_atomic and ansible_os_family != 'CoreOS' + and osd_containerized_deployment_with_kv From 9e252c6c44d6be99da779dcd1f4a9866276a5c5d Mon Sep 17 00:00:00 2001 From: pprokop Date: Wed, 30 Mar 2016 12:22:32 +0200 Subject: [PATCH 2/4] Adding missing space --- roles/ceph-osd/templates/ceph-osd.service.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/ceph-osd/templates/ceph-osd.service.j2 b/roles/ceph-osd/templates/ceph-osd.service.j2 index f1c6e99ff..5f7dc5983 100644 --- a/roles/ceph-osd/templates/ceph-osd.service.j2 +++ b/roles/ceph-osd/templates/ceph-osd.service.j2 @@ -12,7 +12,7 @@ ExecStart=/usr/bin/docker run --rm --net=host --pid=host\ -v /etc/ceph:/etc/ceph \ {% else -%} -e KV_TYPE={{kv_type}} \ - -e KV_IP={{kv_endpoint}}\ + -e KV_IP={{kv_endpoint}} \ {% endif -%} -v /dev:/dev \ --privileged \ From 5705cc71a314c9de43048910034f6be2015473a8 Mon Sep 17 00:00:00 2001 From: pprokop Date: Wed, 30 Mar 2016 12:40:57 +0200 Subject: [PATCH 3/4] Changing when statements --- .../tasks/docker/start_docker_osd.yml | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/roles/ceph-osd/tasks/docker/start_docker_osd.yml b/roles/ceph-osd/tasks/docker/start_docker_osd.yml index b4b29f325..cb57e8a78 100644 --- a/roles/ceph-osd/tasks/docker/start_docker_osd.yml +++ b/roles/ceph-osd/tasks/docker/start_docker_osd.yml @@ -24,7 +24,8 @@ env: "OSD_DEVICE={{ item }},{{ ceph_osd_docker_prepare_env }}" volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/dev/:/dev/" with_items: ceph_osd_docker_devices - when: ceph_osd_docker_prepare_env is defined and not osd_containerized_deployment_with_kv + when: ceph_osd_docker_prepare_env is defined and + not osd_containerized_deployment_with_kv - name: prepare ceph osd disk with kv_store docker: @@ -38,7 +39,8 @@ env: "OSD_DEVICE={{ item }},KV_TYPE={{kv_type}},KV_IP={{kv_endpoint}},{{ ceph_osd_docker_prepare_env }}" ignore_errors: true with_items: ceph_osd_docker_devices - when: ceph_osd_docker_prepare_env is defined and osd_containerized_deployment_with_kv + when: ceph_osd_docker_prepare_env is defined and + osd_containerized_deployment_with_kv # Use systemd to manage container on Atomic host - name: generate systemd unit file @@ -57,18 +59,21 @@ dest: /etc/systemd/system/multi-user.target.wants/ceph-osd@{{ item | basename }}.service state: link with_items: ceph_osd_docker_devices - when: is_atomic or ansible_os_family == 'CoreOS' + when: is_atomic or + ansible_os_family == 'CoreOS' - name: enable systemd unit file for osd instance shell: systemctl enable /etc/systemd/system/multi-user.target.wants/ceph-osd@{{ item | basename }}.service failed_when: false changed_when: false with_items: ceph_osd_docker_devices - when: is_atomic or ansible_os_family == 'CoreOS' + when: is_atomic or + ansible_os_family == 'CoreOS' - name: reload systemd unit files shell: systemctl daemon-reload - when: is_atomic or ansible_os_family == 'CoreOS' + when: is_atomic or + ansible_os_family == 'CoreOS' - name: systemd start osd container service: @@ -77,7 +82,8 @@ enabled: yes changed_when: false with_items: ceph_osd_docker_devices - when: is_atomic or ansible_os_family == 'CoreOS' + when: is_atomic or + ansible_os_family == 'CoreOS' - name: run the ceph osd docker image docker: @@ -90,8 +96,9 @@ 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 - when: not is_atomic and ansible_os_family != 'CoreOS' - and not osd_containerized_deployment_with_kv + when: not is_atomic and + ansible_os_family != 'CoreOS' and + not osd_containerized_deployment_with_kv - name: run the ceph osd docker image with kv @@ -105,5 +112,6 @@ env: "KV_TYPE={{kv_type}},KV_IP={{kv_endpoint}},OSD_DEVICE={{ item }},{{ ceph_osd_docker_extra_env }}" volumes: "/dev/:/dev/" with_items: ceph_osd_docker_devices - when: not is_atomic and ansible_os_family != 'CoreOS' - and osd_containerized_deployment_with_kv + when: not is_atomic and + ansible_os_family != 'CoreOS' and + osd_containerized_deployment_with_kv From 604ea77ecc7e38b3d4afe838bb80a9cbed2c240e Mon Sep 17 00:00:00 2001 From: pprokop Date: Fri, 1 Apr 2016 12:57:58 +0200 Subject: [PATCH 4/4] Changes due to review --- roles/ceph-osd/tasks/docker/main.yml | 4 +- .../tasks/docker/start_docker_osd.yml | 44 +++++++++++-------- roles/ceph-osd/tasks/main.yml | 12 +++-- 3 files changed, 38 insertions(+), 22 deletions(-) diff --git a/roles/ceph-osd/tasks/docker/main.yml b/roles/ceph-osd/tasks/docker/main.yml index 7afa15537..b00d95138 100644 --- a/roles/ceph-osd/tasks/docker/main.yml +++ b/roles/ceph-osd/tasks/docker/main.yml @@ -6,7 +6,9 @@ failed_when: false - include: checks.yml - when: ceph_health.rc != 0 and not osd_containerized_deployment_with_kv + when: + ceph_health.rc != 0 and + not osd_containerized_deployment_with_kv - name: check if it is Atomic host stat: path=/run/ostree-booted diff --git a/roles/ceph-osd/tasks/docker/start_docker_osd.yml b/roles/ceph-osd/tasks/docker/start_docker_osd.yml index cb57e8a78..41c2acf63 100644 --- a/roles/ceph-osd/tasks/docker/start_docker_osd.yml +++ b/roles/ceph-osd/tasks/docker/start_docker_osd.yml @@ -24,8 +24,9 @@ env: "OSD_DEVICE={{ item }},{{ ceph_osd_docker_prepare_env }}" volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/dev/:/dev/" with_items: ceph_osd_docker_devices - when: ceph_osd_docker_prepare_env is defined and - not osd_containerized_deployment_with_kv + when: + ceph_osd_docker_prepare_env is defined and + not osd_containerized_deployment_with_kv - name: prepare ceph osd disk with kv_store docker: @@ -39,8 +40,9 @@ env: "OSD_DEVICE={{ item }},KV_TYPE={{kv_type}},KV_IP={{kv_endpoint}},{{ ceph_osd_docker_prepare_env }}" ignore_errors: true with_items: ceph_osd_docker_devices - when: ceph_osd_docker_prepare_env is defined and - osd_containerized_deployment_with_kv + when: + ceph_osd_docker_prepare_env is defined and + osd_containerized_deployment_with_kv # Use systemd to manage container on Atomic host - name: generate systemd unit file @@ -59,21 +61,24 @@ dest: /etc/systemd/system/multi-user.target.wants/ceph-osd@{{ item | basename }}.service state: link with_items: ceph_osd_docker_devices - when: is_atomic or - ansible_os_family == 'CoreOS' + when: + is_atomic or + ansible_os_family == 'CoreOS' - name: enable systemd unit file for osd instance shell: systemctl enable /etc/systemd/system/multi-user.target.wants/ceph-osd@{{ item | basename }}.service failed_when: false changed_when: false with_items: ceph_osd_docker_devices - when: is_atomic or - ansible_os_family == 'CoreOS' + when: + is_atomic or + ansible_os_family == 'CoreOS' - name: reload systemd unit files shell: systemctl daemon-reload - when: is_atomic or - ansible_os_family == 'CoreOS' + when: + is_atomic or + ansible_os_family == 'CoreOS' - name: systemd start osd container service: @@ -82,8 +87,9 @@ enabled: yes changed_when: false with_items: ceph_osd_docker_devices - when: is_atomic or - ansible_os_family == 'CoreOS' + when: + is_atomic or + ansible_os_family == 'CoreOS' - name: run the ceph osd docker image docker: @@ -96,9 +102,10 @@ 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 - when: not is_atomic and - ansible_os_family != 'CoreOS' and - not osd_containerized_deployment_with_kv + when: + not is_atomic and + ansible_os_family != 'CoreOS' and + not osd_containerized_deployment_with_kv - name: run the ceph osd docker image with kv @@ -112,6 +119,7 @@ env: "KV_TYPE={{kv_type}},KV_IP={{kv_endpoint}},OSD_DEVICE={{ item }},{{ ceph_osd_docker_extra_env }}" volumes: "/dev/:/dev/" with_items: ceph_osd_docker_devices - when: not is_atomic and - ansible_os_family != 'CoreOS' and - osd_containerized_deployment_with_kv + when: + not is_atomic and + ansible_os_family != 'CoreOS' and + osd_containerized_deployment_with_kv diff --git a/roles/ceph-osd/tasks/main.yml b/roles/ceph-osd/tasks/main.yml index fcda24dde..9f4f4d887 100644 --- a/roles/ceph-osd/tasks/main.yml +++ b/roles/ceph-osd/tasks/main.yml @@ -3,13 +3,19 @@ when: not osd_containerized_deployment - include: ./scenarios/journal_collocation.yml - when: journal_collocation and not osd_containerized_deployment + when: + journal_collocation and + not osd_containerized_deployment - include: ./scenarios/raw_multi_journal.yml - when: raw_multi_journal and not osd_containerized_deployment + when: + raw_multi_journal and + not osd_containerized_deployment - include: ./scenarios/osd_directory.yml - when: osd_directory and not osd_containerized_deployment + when: + osd_directory and + not osd_containerized_deployment - include: ./docker/main.yml when: osd_containerized_deployment