Merge pull request #930 from font/rbdmirror

Updates for containerized rbd-mirror role
pull/928/head
Leseb 2016-08-12 11:19:38 +02:00 committed by GitHub
commit bf2068d5f5
3 changed files with 6 additions and 15 deletions

View File

@ -8,6 +8,5 @@
shell: chcon -Rt svirt_sandbox_file_t {{ item }} shell: chcon -Rt svirt_sandbox_file_t {{ item }}
with_items: with_items:
- /etc/ceph - /etc/ceph
- /var/lib/ceph
changed_when: false changed_when: false
when: sestatus.stdout != 'Disabled' when: sestatus.stdout != 'Disabled'

View File

@ -4,21 +4,14 @@
become: true become: true
template: template:
src: "{{ role_path }}/templates/ceph-rbd-mirror.service.j2" 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" owner: "root"
group: "root" group: "root"
mode: "0644" mode: "0644"
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' 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 - 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 failed_when: false
changed_when: false changed_when: false
when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS' when: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
@ -39,9 +32,9 @@
- name: run the ceph rbd mirror docker image - name: run the ceph rbd mirror docker image
docker: docker:
image: "{{ ceph_rbd_mirror_docker_username }}/{{ ceph_rbd_mirror_docker_imagename }}" image: "{{ ceph_rbd_mirror_docker_username }}/{{ ceph_rbd_mirror_docker_imagename }}:{{ ceph_rbd_mirror_docker_image_tag }}"
name: ceph-{{ ansible_hostname }}-rbd-mirror name: "{{ ansible_hostname }}"
net: host net: host
state: running 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' when: ansible_os_family != 'RedHat' and ansible_os_family != 'CoreOS'

View File

@ -8,7 +8,6 @@ ExecStartPre=-/usr/bin/docker stop {{ ansible_hostname }}
ExecStartPre=-/usr/bin/docker rm {{ ansible_hostname }} ExecStartPre=-/usr/bin/docker rm {{ ansible_hostname }}
ExecStart=/usr/bin/docker run --rm --net=host \ ExecStart=/usr/bin/docker run --rm --net=host \
{% if not rbd_mirror_containerized_deployment_with_kv -%} {% if not rbd_mirror_containerized_deployment_with_kv -%}
-v /var/lib/ceph:/var/lib/ceph \
-v /etc/ceph:/etc/ceph \ -v /etc/ceph:/etc/ceph \
{% else -%} {% else -%}
-e KV_TYPE={{kv_type}} \ -e KV_TYPE={{kv_type}} \
@ -18,7 +17,7 @@ ExecStart=/usr/bin/docker run --rm --net=host \
--privileged \ --privileged \
-e CEPH_DAEMON=RBD_MIRROR \ -e CEPH_DAEMON=RBD_MIRROR \
--name={{ ansible_hostname }} \ --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 }} ExecStopPost=-/usr/bin/docker stop {{ ansible_hostname }}
Restart=always Restart=always
RestartSec=10s RestartSec=10s