From 0d71f9fb790c0ac04c739c20296bed60c2cbc10b Mon Sep 17 00:00:00 2001 From: Ivan Font Date: Thu, 11 Aug 2016 18:21:57 -0700 Subject: [PATCH] Updates for containerized rbd-mirror role - Remove /var/lib/ceph dependencies - Add support for rbd-mirror image tag Signed-off-by: Ivan Font --- roles/ceph-rbd-mirror/tasks/docker/selinux.yml | 1 - .../tasks/docker/start_docker_rbd_mirror.yml | 17 +++++------------ .../templates/ceph-rbd-mirror.service.j2 | 3 +-- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/roles/ceph-rbd-mirror/tasks/docker/selinux.yml b/roles/ceph-rbd-mirror/tasks/docker/selinux.yml index 3630824d7..ce8b3054f 100644 --- a/roles/ceph-rbd-mirror/tasks/docker/selinux.yml +++ b/roles/ceph-rbd-mirror/tasks/docker/selinux.yml @@ -8,6 +8,5 @@ shell: chcon -Rt svirt_sandbox_file_t {{ item }} with_items: - /etc/ceph - - /var/lib/ceph changed_when: false when: sestatus.stdout != 'Disabled' diff --git a/roles/ceph-rbd-mirror/tasks/docker/start_docker_rbd_mirror.yml b/roles/ceph-rbd-mirror/tasks/docker/start_docker_rbd_mirror.yml index fcd34cc7a..abd100687 100644 --- a/roles/ceph-rbd-mirror/tasks/docker/start_docker_rbd_mirror.yml +++ b/roles/ceph-rbd-mirror/tasks/docker/start_docker_rbd_mirror.yml @@ -4,21 +4,14 @@ become: true template: src: "{{ role_path }}/templates/ceph-rbd-mirror.service.j2" - dest: /var/lib/ceph/ceph-rbd-mirror@.service + dest: /etc/systemd/system/ceph-rbd-mirror@.service owner: "root" group: "root" mode: "0644" when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' -- name: link systemd unit file for rbd mirror instance - file: - src: /var/lib/ceph/ceph-rbd-mirror@.service - dest: /etc/systemd/system/multi-user.target.wants/ceph-rbd-mirror@{{ ansible_hostname }}.service - state: link - when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' - - name: enable systemd unit file for rbd mirror instance - command: systemctl enable /etc/systemd/system/multi-user.target.wants/ceph-rbd-mirror@{{ ansible_hostname }}.service + command: systemctl enable ceph-rbd-mirror@{{ ansible_hostname }}.service failed_when: false changed_when: false when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' @@ -39,9 +32,9 @@ - name: run the ceph rbd mirror docker image docker: - image: "{{ ceph_rbd_mirror_docker_username }}/{{ ceph_rbd_mirror_docker_imagename }}" - name: ceph-{{ ansible_hostname }}-rbd-mirror + image: "{{ ceph_rbd_mirror_docker_username }}/{{ ceph_rbd_mirror_docker_imagename }}:{{ ceph_rbd_mirror_docker_image_tag }}" + name: "{{ ansible_hostname }}" net: host state: running - volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/etc/localtime:/etc/localtime:ro" + volumes: "/etc/ceph:/etc/ceph,/etc/localtime:/etc/localtime:ro" when: ansible_os_family != 'RedHat' and ansible_os_family != 'CoreOS' diff --git a/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 b/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 index 618967e56..594e26e1c 100644 --- a/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 +++ b/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 @@ -8,7 +8,6 @@ ExecStartPre=-/usr/bin/docker stop {{ ansible_hostname }} ExecStartPre=-/usr/bin/docker rm {{ ansible_hostname }} ExecStart=/usr/bin/docker run --rm --net=host \ {% if not rbd_mirror_containerized_deployment_with_kv -%} - -v /var/lib/ceph:/var/lib/ceph \ -v /etc/ceph:/etc/ceph \ {% else -%} -e KV_TYPE={{kv_type}} \ @@ -18,7 +17,7 @@ ExecStart=/usr/bin/docker run --rm --net=host \ --privileged \ -e CEPH_DAEMON=RBD_MIRROR \ --name={{ ansible_hostname }} \ - {{ ceph_rbd_mirror_docker_username }}/{{ ceph_rbd_mirror_docker_imagename }} + {{ ceph_rbd_mirror_docker_username }}/{{ ceph_rbd_mirror_docker_imagename }}:{{ ceph_rbd_mirror_docker_image_tag }} ExecStopPost=-/usr/bin/docker stop {{ ansible_hostname }} Restart=always RestartSec=10s