Files
openstack-ansible/tests/roles/bootstrap-host/tasks/prepare_zfs.yml
Dmitriy Rabotyagov 466df7ade3 [aio] Refactor loopback preparation
Current implementation of loopback preparation has quite significant
overhead, as we are calling exact same roles multiple times in order
to provision all required loopback devices. Moreover, we duplicate
code and logic needed for their provisionment, despite we have
pretty much 2 usecase - either add sparse file as LVM or format
and directly mount with systemd.

Proposed patch unifies approach by generating a variable with
required keys/parameters to create all required devices at once.

This should reduce overhead caused by multiple role imports/includes.
as each time role tries to install packages and verifies dependencies.

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

33 lines
1.1 KiB
YAML

---
# Copyright 2018, Rackspace US, Inc.
#
# 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: Install zfs packages
ansible.builtin.package:
name: "{{ packages_install_zfs }}"
state: present
update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}"
tags:
- install-packages
- name: Create the ZFS pool
ansible.builtin.command: zpool create osa-test-pool /openstack/lxc-zfs.img
args:
creates: /osa-test-pool
- name: Create the ZFS pool/lxc volume
ansible.builtin.shell: "(zfs list | grep lxc) || zfs create -o mountpoint=/var/lib/lxc osa-test-pool/lxc"
tags:
- skip_ansible_lint