purge-docker: re-implement zap devices

We now run the container and waits until it dies. Prior to this we were
stopping it before completion so not all the devices where zapped.

Signed-off-by: Sébastien Han <seb@redhat.com>
pull/1287/head
Sébastien Han 2017-02-18 02:54:47 +01:00
parent b91d227b99
commit 3b633d5ddc
1 changed files with 17 additions and 33 deletions

View File

@ -283,43 +283,27 @@
with_items: "{{ ceph_osd_docker_devices }}" with_items: "{{ ceph_osd_docker_devices }}"
ignore_errors: true ignore_errors: true
- name: zap ceph osd disk - name: zap ceph osd disks
docker: shell: |
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}" docker run \
name: "{{ ansible_hostname }}-osd-zap-{{ item | regex_replace('/', '') }}" --privileged=true \
net: host --name {{ ansible_hostname }}-osd-zap-{{ item | regex_replace('/', '') }} \
pid: host -v /dev/:/dev/ \
state: started -e OSD_DEVICE={{ item }} \
privileged: yes {{ ceph_docker_image }}:{{ ceph_docker_image_tag }} \
env: "CEPH_DAEMON=zap_device,OSD_DEVICE={{ item }}" zap_device
volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/dev:/dev,/run:/run"
with_items: with_items:
- "{{ ceph_osd_docker_devices }}" - "{{ ceph_osd_docker_devices }}"
- "{{ raw_journal_devices }}" - "{{ raw_journal_devices }}"
- name: remove ceph osd zap disk container - name: wait until the zap containers die
docker: shell: |
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}" docker ps | grep -sq {{ ansible_hostname }}-osd-zap
name: "{{ ansible_hostname }}-osd-zap-{{ item | regex_replace('/', '') }}" register: zap_alive
state: absent failed_when: false
with_items: until: zap_alive.rc != 0
- "{{ ceph_osd_docker_devices }}" retries: 5
- "{{ raw_journal_devices }}" delay: 10
# zap twice
- name: zap ceph osd disk
docker:
image: "{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
name: "{{ ansible_hostname }}-osd-zap-{{ item | regex_replace('/', '') }}"
net: host
pid: host
state: started
privileged: yes
env: "CEPH_DAEMON=zap_device,OSD_DEVICE={{ item }}"
volumes: "/var/lib/ceph:/var/lib/ceph,/etc/ceph:/etc/ceph,/dev:/dev,/run:/run"
with_items:
- "{{ ceph_osd_docker_devices }}"
- "{{ raw_journal_devices }}"
- name: remove ceph osd zap disk container - name: remove ceph osd zap disk container
docker: docker: