Description
Summary
While trying to create Btrfs subvolumes with module community.general.btrfs_subvolume
, I get intermittent errors from my playbooks with the message 'NoneType' object is not subscriptable
.
At first I suspected it has something to do with how it identifies the filesystem to operate on, but no matter whether I provide filesystem_device, filesystem_label or filesystem_uuid, the error remains the same.
I did some more research today and found out about ANSIBLE_KEEP_REMOTE_FILES=1
and the explode
/execute
debug functionality. As far as I can determine, the error originates in the BtrfsSubvolume
class when trying to access the parent
property, since the __info
property is apparently None
. Why that is I cannot tell, but the parent
property explodes in the call to get_mounted_path
while evaluating the condition for the elif
branch.
I decided to stop the "debugging" there and open this bug report instead because I'm not very proficient with Python and you certainly know more about this module than I do...
Issue Type
Bug Report
Component Name
btrfs_subvolume
Ansible Version
ansible [core 2.18.5]
config file = /var/home/hartan/private/device-config/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /root/venv/lib64/python3.13/site-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /root/venv/bin/ansible
python version = 3.13.3 (main, Apr 22 2025, 00:00:00) [GCC 15.0.1 20250418 (Red Hat 15.0.1-0)] (/root/venv/bin/python3)
jinja version = 3.1.6
libyaml = True
Community.general Version
# /root/venv/lib/python3.13/site-packages/ansible_collections
Collection Version
----------------- -------
community.general 10.6.0
# /root/venv/lib64/python3.13/site-packages/ansible_collections
Collection Version
----------------- -------
community.general 10.6.0
Configuration
ANSIBLE_PIPELINING(/var/home/hartan/private/device-config/ansible.cfg) = False
CONFIG_FILE() = /var/home/hartan/private/device-config/ansible.cfg
DEFAULT_FORKS(/var/home/hartan/private/device-config/ansible.cfg) = 10
DEFAULT_HOST_LIST(/var/home/hartan/private/device-config/ansible.cfg) = ['/var/home/hartan/private/device-config/hosts']
DEFAULT_KEEP_REMOTE_FILES(env: ANSIBLE_KEEP_REMOTE_FILES) = True
EDITOR(env: EDITOR) = /usr/bin/vi
INTERPRETER_PYTHON(/var/home/hartan/private/device-config/ansible.cfg) = auto_silent
GALAXY_SERVERS:
OS / Environment
- Fedora 42 Silverblue (42.20250520.0)
- This is the host where the module fails
- Ansible is running from a Container (I can post the Containerfile here if you're interested)
Steps to Reproduce
- name: Create subvolume
community.general.btrfs_subvolume:
automount: true
default: false
state: "present"
filesystem_uuid: "{{ blkdev_uuid.stdout }}"
name: "{{ subvol.path }}"
Here's the snippet from my playbook that fails. In the particular case the variables are as follows:
subvol.path
:"/@nextcloud"
blkdev_uuid
:b5e0a030-80f4-4731-bd1c-c6d0bd3dbc5e
I'm afraid I can't provide anything here. The issue doesn't crop up on all of my hosts, only on a select few. On these hosts, though, it seems to be pretty reproducible. I cannot tell you what the difference is, though. If you have any ideas, please let me know.
Expected Results
I expected the subvolume to be created. Instead I got the error mentioned above.
Actual Results
TASK [btrfs : Create subvolume] *************************************************************************************
task path: /var/home/hartan/private/device-config/roles/btrfs/tasks/subvolumes.yml:25
Using module file /root/venv/lib64/python3.13/site-packages/ansible_collections/community/general/plugins/modules/btrfs_subvolume.py
<totan> PUT /root/.ansible/tmp/ansible-local-1dt5a5dm7/tmpcpbe9jvt TO /var/home/hartan/.ansible/tmp/ansible-tmp-1747734222.4850159-179-281043374930475/AnsiballZ_btrfs_subvolume.py
<totan> SSH: EXEC sshpass -d12 sftp -o BatchMode=no -b - -vvv -o ControlMaster=auto -o ControlPersist=3600s -o 'User="hartan"' -o ConnectTimeout=10 -o 'ControlPath="/root/.ansible/cp/1f7874c4cb"' '[totan]'
<totan> SSH: EXEC sshpass -d12 ssh -vvv -o ControlMaster=auto -o ControlPersist=3600s -o 'User="hartan"' -o ConnectTimeout=10 -o 'ControlPath="/root/.ansible/cp/1f7874c4cb"' totan '/bin/sh -c '"'"'chmod u+x /var/home/hartan/.ansible/tmp/ansible-tmp-1747734222.4850159-179-281043374930475/ /var/home/hartan/.ansible/tmp/ansible-tmp-1747734222.4850159-179-281043374930475/AnsiballZ_btrfs_subvolume.py && sleep 0'"'"''
<totan> SSH: EXEC sshpass -d12 ssh -vvv -o ControlMaster=auto -o ControlPersist=3600s -o 'User="hartan"' -o ConnectTimeout=10 -o 'ControlPath="/root/.ansible/cp/1f7874c4cb"' -tt totan '/bin/sh -c '"'"'sudo -H -S -p "[sudo via ansible, key=rvdopgofpphimzrpjkdzrsbdffifyteb] password:" -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-rvdopgofpphimzrpjkdzrsbdffifyteb ; /usr/bin/python3.13 /var/home/hartan/.ansible/tmp/ansible-tmp-1747734222.4850159-179-281043374930475/AnsiballZ_btrfs_subvolume.py'"'"'"'"'"'"'"'"' && sleep 0'"'"''
Escalation succeeded
debug2: Received exit status from master 1
Shared connection to totan closed.
fatal: [totan]: FAILED! => {
"changed": false,
"filesystem": {
"default_subvolume": null,
"devices": [
"/dev/mapper/luks-4453baf3-8839-4977-a128-f964b5e78cfb"
],
"label": "data-storage",
"subvolumes": [],
"uuid": "b5e0a030-80f4-4731-bd1c-c6d0bd3dbc5e"
},
"invocation": {
"module_args": {
"automount": true,
"default": false,
"filesystem_device": null,
"filesystem_label": null,
"filesystem_uuid": "b5e0a030-80f4-4731-bd1c-c6d0bd3dbc5e",
"name": "/@nextcloud",
"recursive": false,
"snapshot_conflict": "skip",
"snapshot_source": null,
"state": "present"
}
},
"modifications": [],
"msg": "'NoneType' object is not subscriptable",
"target_subvolume_id": null
}
I removed a lot of debug output where I think somewhat sensitive data may have been included.
Code of Conduct
- I agree to follow the Ansible Code of Conduct