register: osd_tree
run_once: true
+ - name: set_fact container_run_cmd
+ set_fact:
+ container_run_cmd: "{{ container_binary + ' run --rm --privileged=true --ulimit nofile=1024:4096 --net=host --pid=host --ipc=host -v /dev:/dev -v /etc/ceph:/etc/ceph -v /var/lib/ceph:/var/lib/ceph -v /var/run:/var/run --entrypoint=' if containerized_deployment else '' }}ceph-volume {{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else '' }}"
+
- name: get ceph-volume lvm inventory data
- command: >
- {{ container_binary }} run --rm --privileged=true
- --ulimit nofile=1024:4096 --net=host --pid=host --ipc=host
- -v /dev:/dev -v /etc/ceph:/ceph/ceph
- -v /var/lib/ceph:/var/lib/ceph
- -v /var/run:/var/run
- --entrypoint=ceph-volume
- {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
- inventory --format json
+ command: "{{ container_run_cmd }} --cluster {{ cluster }} inventory --format json"
register: ceph_volume_inventory
- name: set_fact inventory
with_items: "{{ ceph_disk_osds_devices | default([]) }}"
- name: get simple scan data
- command: >
- {{ container_binary }} run --rm --privileged=true
- --ulimit nofile=1024:4096 --net=host --pid=host --ipc=host
- -v /dev:/dev -v /etc/ceph:/etc/ceph
- -v /var/lib/ceph:/var/lib/ceph
- -v /var/run:/var/run
- --entrypoint=ceph-volume
- {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
- simple scan {{ item.item + 'p1' if item.item is match('/dev/(cciss/c[0-9]d[0-9]|nvme[0-9]n[0-9]){1,2}$') else item.item + '1' }} --stdout
+ command: "{{ container_run_cmd }} --cluster {{ cluster }} simple scan {{ item.item + 'p1' if item.item is match('/dev/(cciss/c[0-9]d[0-9]|nvme[0-9]n[0-9]){1,2}$') else item.item + '1' }} --stdout"
register: simple_scan
with_items: "{{ partlabel.results | default([]) }}"
when: item.stdout == 'ceph data'
failed_when: false
changed_when: false
when:
- - (item.0.stdout | from_json).encrypted | default(False)
- -
- item.1.stdout == 'ceph data'
+ - (item.0.stdout | from_json).encrypted | default(False)
- name: ensure dmcrypt for journal device is closed
command: cryptsetup close "{{ (item.0.stdout | from_json).journal.uuid }}"
failed_when: false
changed_when: false
when:
- - (item.0.stdout | from_json).encrypted | default(False)
- item.1.stdout == 'ceph data'
+ - (item.0.stdout | from_json).encrypted | default(False)
- name: zap data devices
- command: >
- {{ container_binary }} run --rm --privileged=true
- --ulimit nofile=1024:4096 --net=host --pid=host --ipc=host
- -v /dev:/dev -v /etc/ceph:/etc/ceph
- -v /var/lib/ceph:/var/lib/ceph
- -v /var/run:/var/run
- --entrypoint=ceph-volume
- {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
- lvm zap --destroy {{ (item.0.stdout | from_json).data.path }}
+ command: "{{ container_run_cmd }} --cluster {{ cluster }} lvm zap --destroy {{ (item.0.stdout | from_json).data.path }}"
with_together:
- "{{ simple_scan.results }}"
- "{{ partlabel.results }}"
when: item.1.stdout == 'ceph data'
- name: zap journal devices
- command: >
- {{ container_binary }} run --rm --privileged=true
- --ulimit nofile=1024:4096 --net=host --pid=host --ipc=host
- -v /dev:/dev -v /etc/ceph:/etc/ceph
- -v /var/lib/ceph:/var/lib/ceph
- -v /var/run:/var/run
- --entrypoint=ceph-volume
- {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
- lvm zap --destroy {{ (item.0.stdout | from_json).journal.path }}
+ command: "{{ container_run_cmd }} --cluster {{ cluster }} lvm zap --destroy {{ (item.0.stdout | from_json).journal.path }}"
with_together:
- "{{ simple_scan.results }}"
- "{{ partlabel.results }}"
- (item.0.stdout | from_json).journal.path is defined
- name: get ceph-volume lvm list data
- command: >
- {{ container_binary }} run --rm --privileged=true
- --ulimit nofile=1024:4096 --net=host --pid=host --ipc=host
- -v /dev:/dev -v /etc/ceph:/ceph/ceph
- -v /var/lib/ceph:/var/lib/ceph
- -v /var/run:/var/run
- --entrypoint=ceph-volume
- {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}
- lvm list --format json
+ command: "{{ container_run_cmd }} --cluster {{ cluster }} lvm list --format json"
register: ceph_volume_lvm_list
- name: set_fact _lvm_list
with_items: "{{ _lvm_list }}"
changed_when: false
failed_when: false
- when: item['tags']['ceph.encrypted'] | int == 1
+ when: item['tags'].get('ceph.encrypted', 0) | int == 1
- name: set_fact osd_fsid_list
set_fact:
name: ceph-handler
- import_role:
name: ceph-container-common
+ when: containerized_deployment | bool
- import_role:
name: ceph-osd
vars: