-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
bugThis issue/PR relates to a bugThis issue/PR relates to a bughas_prmodulemodulemodulepluginsplugin (any type)plugin (any type)
Description
Summary
When using symlinks (e.g. /dev/disk/by-id/...), the module tries to recreate the zpool on rerun and fails as the disks are already part of a zpool.
Issue Type
Bug Report
Component Name
zpool
Ansible Version
ansible [core 2.18.6]
config file = /home/n3ph/Repositories/infra/code/ansible/ansible.cfg
configured module search path = ['/home/n3ph/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.13/site-packages/ansible
ansible collection location = /home/n3ph/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.13.6 (main, Aug 7 2025, 00:00:00) [GCC 15.2.1 20250808 (Red Hat 15.2.1-1)] (/usr/bin/python3)
jinja version = 3.1.6
libyaml = TrueCommunity.general Version
# /home/n3ph/.ansible/collections/ansible_collections
Collection Version
----------------- -------
community.general 11.1.1
# /usr/lib/python3.13/site-packages/ansible_collections
Collection Version
----------------- -------
community.general 10.7.0 Configuration
ANSIBLE_NOCOWS(/home/n3ph/Repositories/infra/code/ansible/ansible.cfg) = True
CONFIG_FILE() = /home/n3ph/Repositories/infra/code/ansible/ansible.cfg
DEFAULT_BECOME(/home/n3ph/Repositories/infra/code/ansible/ansible.cfg) = True
DEFAULT_BECOME_METHOD(/home/n3ph/Repositories/infra/code/ansible/ansible.cfg) = su
DEFAULT_BECOME_USER(/home/n3ph/Repositories/infra/code/ansible/ansible.cfg) = root
DEFAULT_FORKS(/home/n3ph/Repositories/infra/code/ansible/ansible.cfg) = 50
DEFAULT_GATHERING(/home/n3ph/Repositories/infra/code/ansible/ansible.cfg) = explicit
DEFAULT_REMOTE_PORT(/home/n3ph/Repositories/infra/code/ansible/ansible.cfg) = 22
DEFAULT_REMOTE_USER(/home/n3ph/Repositories/infra/code/ansible/ansible.cfg) = ansible
EDITOR(env: EDITOR) = nano
GALAXY_SERVERS:OS / Environment
FAR 42
Steps to Reproduce
- name: ZFS | Config | Manage pools
community.general.zpool:
name: "{{ item.name }}"
vdevs: "{{ item.vdevs | default({}) }}"
filesystem_properties: "{{ item.filesystem_properties | default({}) }}"
mountpoint: "{{ item.mountpoint }}"
pool_properties: "{{ item.pool_properties | default({}) }}"
loop: "{{ zfs_pools }}"
vars:
zfs_pools:
- name: test
vdevs:
- type: mirror
disks:
- /dev/disk/by-id/nvme-VENDOR_MODEL_SERIAL1 # /dev/nvme0n1
- /dev/disk/by-id/nvme-VENDOR_MODEL_SERIAL2 # /dev/nvme1n1
mountpoint: /tank-db
filesystem_properties:
atime: false
compression: zstd-fast
logbias: throughput
primarycache: metadata
recordsize: 16K
redundant_metadata: most
relatime: false
pool_properties:
ashift: 12
volumes:
- name: test
extra_zfs_properties:
mountpoint: /mnt
encryption: aes-256-gcm
keyformat: passphrase
keylocation: file:///etc/zfs/keys/test.keyExpected Results
Re-executing the task should be ok.
Actual Results
First run:
changed: [testbox] => (item={'name': 'tank-db', 'vdevs': [{'type': 'mirror', 'disks': ['/dev/disk/by-id/nvme-VENDOR_MODEL_SERIAL1', '/dev/disk/by-id/nvme-VENDOR_MODEL_SERIAL2']}], 'mountpoint': '/tank-db', 'filesystem_properties': {'atime': False, 'compression': 'zstd-fast', 'logbias': 'throughput', 'primarycache': 'metadata', 'recordsize': '16K', 'redundant_metadata': 'most', 'relatime': False}, 'pool_properties': {'ashift': 12}, 'volumes': [{'name': 'test', 'extra_zfs_properties': {'mountpoint': '/mnt', 'encryption': 'aes-256-gcm', 'keyformat': 'passphrase', 'keylocation': 'file:///etc/zfs/keys/test.key'}}]})Second run:
failed: [testbox] (item={'name': 'tank-db', 'vdevs': [{'type': 'mirror', 'disks': ['/dev/disk/by-id/nvme-VENDOR_MODEL_SERIAL1', '/dev/disk/by-id/nvme-VENDOR_MODEL_SERIAL2']}], 'mountpoint': '/tank-db', 'filesystem_properties': {'atime': False, 'compression': 'zstd-fast', 'logbias': 'throughput', 'primarycache': 'metadata', 'recordsize': '16K', 'redundant_metadata': 'most', 'relatime': False}, 'pool_properties': {'ashift': 12}, 'volumes': [{'name': 'test', 'extra_zfs_properties': {'mountpoint': '/mnt', 'encryption': 'aes-256-gcm', 'keyformat': 'passphrase', 'keylocation': 'file:///etc/zfs/keys/test.key'}}]}) => {"ansible_loop_var": "item", "changed": false, "cmd": "/usr/bin/zpool add -o ashift=12 tank-db mirror /dev/disk/by-id/nvme-VENDOR_MODEL_SERIAL1 /dev/disk/by-id/nvme-VENDOR_MODEL_SERIAL2", "item": {"filesystem_properties": {"atime": false, "compression": "zstd-fast", "logbias": "throughput", "primarycache": "metadata", "recordsize": "16K", "redundant_metadata": "most", "relatime": false}, "mountpoint": "/tank-db", "name": "tank-db", "pool_properties": {"ashift": 12}, "vdevs": [{"disks": ["/dev/disk/by-id/nvme-VENDOR_MODEL_SERIAL1", "/dev/disk/by-id/nvme-VENDOR_MODEL_SERIAL2"], "type": "mirror"}], "volumes": [{"extra_zfs_properties": {"encryption": "aes-256-gcm", "keyformat": "passphrase", "keylocation": "file:///etc/zfs/keys/test.key", "mountpoint": "/mnt"}, "name": "test"}]}, "msg": "/dev/disk/by-id/nvme-VENDOR_MODEL_SERIAL1 is in use and contains a unknown filesystem.\n/dev/disk/by-id/nvme-VENDOR_MODEL_SERIAL2 is in use and contains a unknown filesystem.", "rc": 1, "stderr": "/dev/disk/by-id/nvme-VENDOR_MODEL_SERIAL1 is in use and contains a unknown filesystem.\n/dev/disk/by-id/nvme-VENDOR_MODEL_SERIAL2 is in use and contains a unknown filesystem.\n", "stderr_lines": ["/dev/disk/by-id/nvme-VENDOR_MODEL_SERIAL1 is in use and contains a unknown filesystem.", "/dev/disk/by-id/nvme-VENDOR_MODEL_SERIAL2 is in use and contains a unknown filesystem."], "stdout": "", "stdout_lines": []}Code of Conduct
- I agree to follow the Ansible Code of Conduct
calvinbui
Metadata
Metadata
Assignees
Labels
bugThis issue/PR relates to a bugThis issue/PR relates to a bughas_prmodulemodulemodulepluginsplugin (any type)plugin (any type)