mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-02-04 07:51:50 +00:00
* Add zpool module * Add botmeta * Use str.format instead of f-strings * Remove nonlocal usage * Add check to only pass ashift to zpool add * Extend ansible_spec and remove unnecessary validation * Apply suggestions and fix style * Fix indentation of yaml lists * Add method to normalize vdevs Fix role: none in vdevs * Use CmdRunner instead of run_command * Fix styling and documentation * Use str.format instead of f-strings * Make sure vdevs are only required when state is present * Add support for loop devices and normalize vdev type * Add integration tests * Add missing test dependencies for alpine and redhat * Skip integration tests on rhel10 until there there packages available * Use package module for better auto detection of package manager on rhel * Add copyright header * Skip tests on rhel and remove redhat install requirements * Ensure loop devices under /dev exist * Enable usage of files as pool devices * Remove disk setup * Use files as disks * Apply suggestions * Fix argument_spec
73 lines
2.2 KiB
YAML
73 lines
2.2 KiB
YAML
---
|
|
# Copyright (c) 2025, Tom Hesse <contact@tomhesse.xyz>
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
- name: Ensure pool with two mirrored disks exists
|
|
community.general.zpool:
|
|
name: "{{ zpool_generic_pool_name }}"
|
|
pool_properties:
|
|
ashift: 12
|
|
filesystem_properties:
|
|
compression: off
|
|
vdevs:
|
|
- type: mirror
|
|
disks: "{{ zpool_vdevs_disk_config.vdev3 }}"
|
|
- type: mirror
|
|
disks: "{{ zpool_vdevs_disk_config.vdev4 }}"
|
|
state: present
|
|
|
|
- name: Test changing of a pool property
|
|
block:
|
|
- name: Change ashift from 12 to 13
|
|
community.general.zpool:
|
|
name: "{{ zpool_generic_pool_name }}"
|
|
pool_properties:
|
|
ashift: 13
|
|
vdevs:
|
|
- type: mirror
|
|
disks: "{{ zpool_vdevs_disk_config.vdev3 }}"
|
|
- type: mirror
|
|
disks: "{{ zpool_vdevs_disk_config.vdev4 }}"
|
|
state: present
|
|
|
|
- name: Check ashift
|
|
ansible.builtin.command:
|
|
cmd: "zpool get -H -o value ashift {{ zpool_generic_pool_name }}"
|
|
changed_when: false
|
|
register: ashift_check
|
|
|
|
- name: Assert ashift has changed
|
|
ansible.builtin.assert:
|
|
that:
|
|
- "'13' in ashift_check.stdout"
|
|
|
|
- name: Test changing of a dataset property
|
|
block:
|
|
- name: Change compression from off to lz4
|
|
community.general.zpool:
|
|
name: "{{ zpool_generic_pool_name }}"
|
|
filesystem_properties:
|
|
compression: lz4
|
|
vdevs:
|
|
- type: mirror
|
|
disks: "{{ zpool_vdevs_disk_config.vdev3 }}"
|
|
- type: mirror
|
|
disks: "{{ zpool_vdevs_disk_config.vdev4 }}"
|
|
state: present
|
|
|
|
- name: Check compression
|
|
ansible.builtin.command:
|
|
cmd: "zfs get -H -o value compression {{ zpool_generic_pool_name }}"
|
|
changed_when: false
|
|
register: compression_check
|
|
|
|
- name: Assert compression has changed
|
|
ansible.builtin.assert:
|
|
that:
|
|
- "'lz4' in compression_check.stdout"
|
|
|
|
- name: Cleanup pool
|
|
community.general.zpool:
|
|
name: "{{ zpool_generic_pool_name }}"
|
|
state: absent
|