Skip to content

zpool: state=present is not idempotent #10771

@SudoNova

Description

@SudoNova

Summary

First time that I try creating a pool It's ok but the second time I get this error:

[WARNING]: zpool add only supports 'ashift', ignoring: ['autotrim']
fatal: [synapse]: FAILED! => {"changed": false, "cmd": "/usr/sbin/zpool add tkh sdb", "msg": "/dev/sdb is in use and contains a unknown filesystem.", "rc": 1, "stderr": "/dev/sdb is in use and contains a unknown filesystem.\n", "stderr_lines": ["/dev/sdb is in use and contains a unknown filesystem."], "stdout": "", "stdout_lines": []}

Issue Type

Bug Report

Component Name

zpool

Ansible Version

ansible [core 2.18.7]
  config file = /home/alvin/git/ansible/ansible.cfg
  configured module search path = ['/home/alvin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /nix/store/09n1iiq52wcy508ivv37hbh9d00fgvz0-python3.12-ansible-core-2.18.7/lib/python3.12/site-packages/ansible
  ansible collection location = /home/alvin/.ansible/collections:/usr/share/ansible/collections
  executable location = /nix/store/09n1iiq52wcy508ivv37hbh9d00fgvz0-python3.12-ansible-core-2.18.7/bin/ansible
  python version = 3.12.11 (main, Jun  3 2025, 15:41:47) [GCC 14.3.0] (/nix/store/bbyp6vkdszn6a14gqnfx8l5j3mhfcnfs-python3-3.12.11/bin/python3.12)
  jinja version = 3.1.6
  libyaml = True

Community.general Version

11.2.1

Configuration

OS / Environment

NixOs 25.05

Steps to Reproduce

- name: Configure Zpool
  become: true
  community.general.zpool:
    name: tkh
    pool_properties:
      autotrim: on
    filesystem_properties:
      atime: off
      compression: zstd
      mountpoint: legacy
      recordsize: 1M
      xattr: sa
    vdevs:
      - disks: "{{ fs.zfs.devs | default(['sdb']) }}"
    state: present
  when:
    - fs is defined
    - fs.zfs is defined

Expected Results

Ok

Actual Results

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue/PR relates to a bughas_prmodulemodulepluginsplugin (any type)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions