storage
storage copied to clipboard
LVM: Running role in --check mode causes failure at TASK [linux-system-roles.storage : get required packages]
Problem statement and error
I was testing the role for the first time and wanted to run it in --check mode to verify the behaviour, but it would fail. Here is the error
TASK [linux-system-roles.storage : get required packages] *****************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NameError: name 'devices' is not defin
ed
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/home/bblasco/.ansible
/tmp/ansible-tmp-1651110898.850052-489119-163256305427217/AnsiballZ_blivet.py\", line 102, in <module>\n _ansiballz_main()\n File \
"/home/bblasco/.ansible/tmp/ansible-tmp-1651110898.850052-489119-163256305427217/AnsiballZ_blivet.py\", line 94, in _ansiballz_main\n
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/bblasco/.ansible/tmp/ansible-tmp-1651110898.850052-489119-1632
56305427217/AnsiballZ_blivet.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.blivet', init_globals=None
, run_name='__main__', alter_sys=True)\n File \"/usr/lib64/python3.8/runpy.py\", line 207, in run_module\n return _run_module_code(
code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.8/runpy.py\", line 97, in _run_module_code\n _run_code(code, mo
d_globals, init_globals,\n File \"/usr/lib64/python3.8/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/tmp/a
nsible_blivet_payload_1xe7hh39/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 577, in <module>\n File \"/tmp/ansible_bli
vet_payload_1xe7hh39/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 578, in BlivetDiskVolume\nNameError: name 'devices' i
s not defined\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
I googled the problem and came across this Red Hat KB article: https://access.redhat.com/solutions/6726561
I am already using Python 3, and was using localhost with connection = local.
I tried to run the playbook in regular (not --check) mode, and it ran perfectly. Subsequent executions of the playbook in --check mode generate no errors either. I have reproduced the issue on two separate machines.
Steps to generate the error
- Create a playbook that uses this role
- Run in check mode - Result = error as per above
- Run same playbook in regular mode - Result = success
- Run in check mode again - Result = success
Environment info
OS: Fedora 32 (also reproducible on Fedora 35) Ansible version: ansible-2.9.21-1.fc32.noarch AND ansible-2.9.27-1.fc35.noarch Link to the playbook I am testing with: https://github.com/benblasco/fedoralaptop/blob/master/nuc_storage_samsung.yml
Please note that this issue was created after discussion with Brian Smith at Red Hat.
Execution log showing
- Run in check mode failing (more than once)
- Run in normal mode succeeding
- Run in check mode succeeding
fixed