2015-07-28 22:05:35 +08:00
|
|
|
---
|
2016-01-14 03:15:35 +08:00
|
|
|
# (rootfs) for reasons I haven't figured out, docker pull and run will fail.
|
|
|
|
- name: pull ceph daemon image
|
2016-02-10 01:35:41 +08:00
|
|
|
shell: "docker pull {{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}"
|
2016-01-14 03:15:35 +08:00
|
|
|
|
2016-02-09 09:49:47 +08:00
|
|
|
- name: prepare ceph osd disk
|
|
|
|
docker:
|
|
|
|
image: "{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}"
|
|
|
|
name: "{{ ansible_hostname }}-osd-prepare-{{ item | regex_replace('/', '') }}"
|
|
|
|
net: host
|
|
|
|
pid: host
|
|
|
|
state: running
|
|
|
|
privileged: yes
|
|
|
|
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
|
|
|
|
|
2016-02-10 01:35:41 +08:00
|
|
|
# Use systemd to manage container on Atomic host
|
|
|
|
- name: generate systemd unit file
|
|
|
|
sudo: true
|
2016-02-10 03:49:22 +08:00
|
|
|
template:
|
2016-02-10 01:35:41 +08:00
|
|
|
src: ceph-osd.service.j2
|
|
|
|
dest: /var/lib/ceph/ceph-osd@.service
|
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
|
|
|
mode: "0644"
|
|
|
|
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
|
|
|
|
|
2015-07-28 22:05:35 +08:00
|
|
|
- name: run the ceph osd docker image
|
2015-10-19 09:24:47 +08:00
|
|
|
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: "OSD_DEVICE={{ item }},{{ ceph_osd_docker_extra_env }}"
|
|
|
|
volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/dev/:/dev/"
|
2015-07-28 22:05:35 +08:00
|
|
|
with_items: ceph_osd_docker_devices
|
2016-02-10 01:35:41 +08:00
|
|
|
when: not is_atomic
|