mirror of https://github.com/ceph/ceph-ansible.git
Merge pull request #865 from PiotrProkop/containerized-osd-with-kv-fix
Fixing containerized deployment with kvpull/882/head
commit
3e32eebdc1
|
@ -123,6 +123,7 @@ osd_containerized_deployment: false
|
||||||
osd_containerized_deployment_with_kv: false
|
osd_containerized_deployment_with_kv: false
|
||||||
kv_type: etcd
|
kv_type: etcd
|
||||||
kv_endpoint: 127.0.0.1
|
kv_endpoint: 127.0.0.1
|
||||||
|
kv_port: 4001
|
||||||
ceph_osd_docker_prepare_env: "OSD_FORCE_ZAP=1"
|
ceph_osd_docker_prepare_env: "OSD_FORCE_ZAP=1"
|
||||||
ceph_osd_docker_username: ceph
|
ceph_osd_docker_username: ceph
|
||||||
ceph_osd_docker_imagename: daemon
|
ceph_osd_docker_imagename: daemon
|
||||||
|
|
|
@ -41,16 +41,20 @@
|
||||||
- not osd_containerized_deployment_with_kv
|
- not osd_containerized_deployment_with_kv
|
||||||
|
|
||||||
- name: prepare ceph osd disk with kv_store
|
- name: prepare ceph osd disk with kv_store
|
||||||
docker:
|
shell: |
|
||||||
image: "{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}:{{ ceph_osd_docker_image_tag }}"
|
docker run --net=host \
|
||||||
name: "{{ ansible_hostname }}-osd-prepare-{{ item.0 | regex_replace('/', '') }}"
|
--pid=host \
|
||||||
net: host
|
--privileged=true \
|
||||||
pid: host
|
--name="{{ ansible_hostname }}-osd-prepare-{{ item.0 |
|
||||||
state: running
|
regex_replace('/', '') }}" \
|
||||||
privileged: yes
|
-v /dev:/dev \
|
||||||
volumes: "{{ item.0 }}:{{ item.0 }}"
|
-e "OSD_DEVICE={{ item.0 }}" \
|
||||||
env: "OSD_DEVICE={{ item.0 }},KV_TYPE={{kv_type}},KV_IP={{kv_endpoint}},{{ ceph_osd_docker_prepare_env }}"
|
-e "{{ ceph_osd_docker_prepare_env }}" \
|
||||||
ignore_errors: true
|
-e CEPH_DAEMON=osd_ceph_disk_prepare \
|
||||||
|
-e KV_TYPE={{kv_type}} \
|
||||||
|
-e KV_IP={{kv_endpoint}} \
|
||||||
|
-e KV_PORT={{kv_port}} \
|
||||||
|
"{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}:{{ ceph_osd_docker_image_tag }}" \
|
||||||
with_together:
|
with_together:
|
||||||
- ceph_osd_docker_devices
|
- ceph_osd_docker_devices
|
||||||
- osd_prepared.results
|
- osd_prepared.results
|
||||||
|
@ -64,23 +68,15 @@
|
||||||
become: true
|
become: true
|
||||||
template:
|
template:
|
||||||
src: "{{ role_path }}/templates/ceph-osd.service.j2"
|
src: "{{ role_path }}/templates/ceph-osd.service.j2"
|
||||||
dest: /var/lib/ceph/ceph-osd@.service
|
dest: /etc/systemd/system/ceph-osd@.service
|
||||||
owner: "root"
|
owner: "root"
|
||||||
group: "root"
|
group: "root"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
failed_when: false
|
failed_when: false
|
||||||
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 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: ansible_os_family == 'RedHat' or ansible_os_family == 'CoreOS'
|
|
||||||
|
|
||||||
- name: enable systemd unit file for osd instance
|
- name: enable systemd unit file for osd instance
|
||||||
shell: systemctl enable /etc/systemd/system/multi-user.target.wants/ceph-osd@{{ item | basename }}.service
|
shell: systemctl enable ceph-osd@{{ item | basename }}.service
|
||||||
failed_when: false
|
failed_when: false
|
||||||
changed_when: false
|
changed_when: false
|
||||||
with_items: ceph_osd_docker_devices
|
with_items: ceph_osd_docker_devices
|
||||||
|
@ -103,7 +99,7 @@
|
||||||
|
|
||||||
- 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 }}:{{ ceph_osd_docker_image_tag }}"
|
||||||
name: "{{ ansible_hostname }}-osd-{{ item | regex_replace('/', '') }}"
|
name: "{{ ansible_hostname }}-osd-{{ item | regex_replace('/', '') }}"
|
||||||
net: host
|
net: host
|
||||||
pid: host
|
pid: host
|
||||||
|
@ -119,7 +115,7 @@
|
||||||
|
|
||||||
- name: run the ceph osd docker image with kv
|
- name: run the ceph osd docker image with kv
|
||||||
docker:
|
docker:
|
||||||
image: "{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}"
|
image: "{{ ceph_osd_docker_username }}/{{ ceph_osd_docker_imagename }}:{{ ceph_osd_docker_image_tag }}"
|
||||||
name: "{{ ansible_hostname }}-osd-{{ item | regex_replace('/', '') }}"
|
name: "{{ ansible_hostname }}-osd-{{ item | regex_replace('/', '') }}"
|
||||||
net: host
|
net: host
|
||||||
pid: host
|
pid: host
|
||||||
|
@ -132,3 +128,4 @@
|
||||||
- ansible_os_family != 'RedHat'
|
- ansible_os_family != 'RedHat'
|
||||||
- ansible_os_family != 'CoreOS'
|
- ansible_os_family != 'CoreOS'
|
||||||
- osd_containerized_deployment_with_kv
|
- osd_containerized_deployment_with_kv
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ After=docker.service
|
||||||
[Service]
|
[Service]
|
||||||
EnvironmentFile=-/etc/environment
|
EnvironmentFile=-/etc/environment
|
||||||
ExecStartPre=-/usr/bin/docker stop {{ ansible_hostname }}-osd-dev%i
|
ExecStartPre=-/usr/bin/docker stop {{ ansible_hostname }}-osd-dev%i
|
||||||
ExecStartPre=-/usr/bin/docker rm {{ ansible_hostname }}-osd-dev%i
|
ExecStartPre=-/usr/bin/docker rm -f {{ ansible_hostname }}-osd-dev%i
|
||||||
ExecStart=/usr/bin/docker run --rm --net=host --pid=host\
|
ExecStart=/usr/bin/docker run --rm --net=host --pid=host\
|
||||||
{% if not osd_containerized_deployment_with_kv -%}
|
{% if not osd_containerized_deployment_with_kv -%}
|
||||||
-v /var/lib/ceph:/var/lib/ceph \
|
-v /var/lib/ceph:/var/lib/ceph \
|
||||||
|
@ -13,6 +13,7 @@ ExecStart=/usr/bin/docker run --rm --net=host --pid=host\
|
||||||
{% else -%}
|
{% else -%}
|
||||||
-e KV_TYPE={{kv_type}} \
|
-e KV_TYPE={{kv_type}} \
|
||||||
-e KV_IP={{kv_endpoint}} \
|
-e KV_IP={{kv_endpoint}} \
|
||||||
|
-e KV_PORT={{kv_port}} \
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
-v /dev:/dev \
|
-v /dev:/dev \
|
||||||
--privileged \
|
--privileged \
|
||||||
|
|
Loading…
Reference in New Issue