mirror of https://github.com/ceph/ceph-ansible.git
start osd daemon via systemd if supported
Signed-off-by: Huamin Chen <hchen@redhat.com>pull/648/head
parent
6cf3fff436
commit
326db629a0
|
@ -4,10 +4,9 @@ After=docker.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
EnvironmentFile=/etc/environment
|
EnvironmentFile=/etc/environment
|
||||||
ExecStartPre=-/usr/bin/docker kill %p
|
ExecStartPre=-/usr/bin/docker rm %i
|
||||||
ExecStartPre=-/usr/bin/docker rm %p
|
|
||||||
ExecStartPre=/usr/bin/mkdir -p /etc/ceph /var/lib/ceph/mon
|
ExecStartPre=/usr/bin/mkdir -p /etc/ceph /var/lib/ceph/mon
|
||||||
ExecStart=/usr/bin/docker run -d --name %p --net=host \
|
ExecStart=/usr/bin/docker run --rm --name %p --net=host \
|
||||||
-v /var/lib/ceph:/var/lib/ceph \
|
-v /var/lib/ceph:/var/lib/ceph \
|
||||||
-v /etc/ceph:/etc/ceph \
|
-v /etc/ceph:/etc/ceph \
|
||||||
--privileged \
|
--privileged \
|
||||||
|
@ -16,9 +15,8 @@ ExecStart=/usr/bin/docker run -d --name %p --net=host \
|
||||||
-e CEPH_PUBLIC_NETWORK={{ ceph_mon_docker_subnet }} \
|
-e CEPH_PUBLIC_NETWORK={{ ceph_mon_docker_subnet }} \
|
||||||
-e MON_NAME={{ ansible_hostname }} \
|
-e MON_NAME={{ ansible_hostname }} \
|
||||||
--name={{ ansible_hostname }} \
|
--name={{ ansible_hostname }} \
|
||||||
{{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}
|
{{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}
|
||||||
ExecStopPost=-/usr/bin/docker stop %p
|
ExecStopPost=-/usr/bin/docker stop %i
|
||||||
ExecStopPost=-/usr/bin/docker rm %p
|
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=10s
|
RestartSec=10s
|
||||||
TimeoutStartSec=120
|
TimeoutStartSec=120
|
||||||
|
|
|
@ -8,6 +8,14 @@
|
||||||
- include: checks.yml
|
- include: checks.yml
|
||||||
when: ceph_health.rc != 0
|
when: ceph_health.rc != 0
|
||||||
|
|
||||||
|
- name: check if it is Atomic host
|
||||||
|
stat: path=/run/ostree-booted
|
||||||
|
register: stat_ostree
|
||||||
|
|
||||||
|
- name: set fact for using Atomic host
|
||||||
|
set_fact:
|
||||||
|
is_atomic='{{ stat_ostree.stat.exists }}'
|
||||||
|
|
||||||
- include: pre_requisite.yml
|
- include: pre_requisite.yml
|
||||||
- include: selinux.yml
|
- include: selinux.yml
|
||||||
when: ansible_os_family == 'RedHat'
|
when: ansible_os_family == 'RedHat'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
# (rootfs) for reasons I haven't figured out, docker pull and run will fail.
|
# (rootfs) for reasons I haven't figured out, docker pull and run will fail.
|
||||||
- name: pull ceph daemon image
|
- name: pull ceph daemon image
|
||||||
shell: "docker pull {{ ceph_mon_docker_username }}/{{ ceph_mon_docker_imagename }}"
|
shell: "docker pull {{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}"
|
||||||
|
|
||||||
- name: prepare ceph osd disk
|
- name: prepare ceph osd disk
|
||||||
docker:
|
docker:
|
||||||
|
@ -16,6 +16,47 @@
|
||||||
with_items: ceph_osd_docker_devices
|
with_items: ceph_osd_docker_devices
|
||||||
when: ceph_osd_docker_prepare_env is defined
|
when: ceph_osd_docker_prepare_env is defined
|
||||||
|
|
||||||
|
# Use systemd to manage container on Atomic host
|
||||||
|
- name: generate systemd unit file
|
||||||
|
sudo: true
|
||||||
|
config_template:
|
||||||
|
src: ceph-osd.service.j2
|
||||||
|
dest: /var/lib/ceph/ceph-osd@.service
|
||||||
|
owner: "root"
|
||||||
|
group: "root"
|
||||||
|
mode: "0644"
|
||||||
|
config_overrides: {}
|
||||||
|
config_type: ini
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
|
- name: link systemd unit file for osd instance
|
||||||
|
file:
|
||||||
|
src: /var/lib/ceph/ceph-osd@.service
|
||||||
|
dest: /etc/systemd/system/multi-user.target.wants/ceph-osd@{{ item | basename }}.service
|
||||||
|
state: link
|
||||||
|
with_items: ceph_osd_docker_devices
|
||||||
|
when: is_atomic
|
||||||
|
|
||||||
|
- 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
|
||||||
|
|
||||||
|
- name: reload systemd unit files
|
||||||
|
shell: systemctl daemon-reload
|
||||||
|
when: is_atomic
|
||||||
|
|
||||||
|
- name: systemd start osd container
|
||||||
|
service:
|
||||||
|
name: ceph-osd@{{ item | basename }}
|
||||||
|
state: started
|
||||||
|
enabled: yes
|
||||||
|
changed_when: false
|
||||||
|
with_items: ceph_osd_docker_devices
|
||||||
|
when: is_atomic
|
||||||
|
|
||||||
- name: run the ceph osd docker image
|
- name: run the ceph osd docker image
|
||||||
docker:
|
docker:
|
||||||
image: "{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}"
|
image: "{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}"
|
||||||
|
@ -27,3 +68,4 @@
|
||||||
env: "OSD_DEVICE={{ item }},{{ ceph_osd_docker_extra_env }}"
|
env: "OSD_DEVICE={{ item }},{{ ceph_osd_docker_extra_env }}"
|
||||||
volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/dev/:/dev/"
|
volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/dev/:/dev/"
|
||||||
with_items: ceph_osd_docker_devices
|
with_items: ceph_osd_docker_devices
|
||||||
|
when: not is_atomic
|
||||||
|
|
Loading…
Reference in New Issue