Files
openstack-ansible/tests/roles/bootstrap-host/tasks/prepare_ceph.yml
Dmitriy Rabotyagov bb1f0acbe2 [aio] Merge ceph configuration files
With related bug [1] being fixed, we can finally merge ceph
configuration files together.

[1] https://bugs.launchpad.net/openstack-ansible/+bug/1649381

Change-Id: I7c10e7fa49af1d3f9c8b81e31f64b300d85b6011
Signed-off-by: Dmitriy Rabotyagov <dmitriy.rabotyagov@cleura.com>
2025-09-22 14:12:08 +00:00

78 lines
2.4 KiB
YAML

---
# Copyright 2016, Logan Vig <logan2211@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Create sparse ceph OSD files
ansible.builtin.command: truncate -s {{ bootstrap_host_loopback_ceph_size }}G /openstack/{{ item }}.img
args:
creates: "/openstack/{{ item }}.img"
with_items: "{{ ceph_osd_images }}"
register: ceph_create
tags:
- ceph-file-create
- name: Run the systemd service role
ansible.builtin.include_role:
name: systemd_service
vars:
systemd_services:
- service_name: "loop-{{ loopback_var }}"
config_overrides:
Unit:
Description: false
After: systemd-udev-settle.service
Service:
RemainAfterExit: true
service_type: oneshot
execstarts:
- /bin/bash -c "/sbin/losetup /dev/loop{{ 10 + loopback_index }} /openstack/{{ loopback_var }}.img"
execstops:
- /bin/bash -c "losetup -d /dev/loop{{ 10 + loopback_index }}"
enabled: true
state: started
systemd_tempd_prefix: openstack
with_items: "{{ ceph_osd_images }}"
loop_control:
loop_var: loopback_var
index_var: loopback_index
tags:
- ceph-config
- name: Set permissions on loopback devices
ansible.builtin.file:
path: "/dev/loop{{ 10 + loopback_index }}"
mode: "0777"
with_items: "{{ ceph_osd_images }}"
loop_control:
index_var: loopback_index
# NOTE(jrosser) ceph-volume is unwilling to automatically create OSD
# directly on loop devices - see http://tracker.ceph.com/issues/36603
# Work around this with manual LVM creation and the advanced lvm OSD
# scenario
- name: Create LVM VG
community.general.lvg:
vg: "vg-{{ item }}"
pvs: "/dev/loop{{ 10 + loopback_index }}"
loop: "{{ ceph_osd_images }}"
loop_control:
index_var: loopback_index
- name: Create LVM LV
community.general.lvol:
lv: "lv-{{ item }}"
vg: "vg-{{ item }}"
size: 100%FREE
loop: "{{ ceph_osd_images }}"