Skip to content

luks_device: can't use device name "crypt00", see issue #409 #817

Open
@inflatador

Description

@inflatador
SUMMARY

If I try to run luks_device against an already-open luks device named 'crypt00', I get a failure.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.crypto.luks_device

ANSIBLE VERSION
ansible [core 2.17.6]
  config file = /Users/user/.ansible.cfg
  configured module search path = ['/Users/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/user/venvs/P311/lib/python3.11/site-packages/ansible
  ansible collection location = /Users/user/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/user/venvs/P311/bin/ansible
  python version = 3.11.9 (main, Apr  4 2024, 00:14:24) [Clang 9.1.0 (clang-902.0.39.2)] (/Users/user/venvs/P311/bin/python)
  jinja version = 3.1.3
  libyaml = True
COLLECTION VERSION

-->

# /Users/user/.ansible/collections/ansible_collections
Collection       Version
---------------- -------
community.crypto 2.22.3

# /Users/user/venvs/P311/lib/python3.11/site-packages/ansible_collections
Collection       Version
---------------- -------
community.crypto 2.22.3
CONFIGURATION
CACHE_PLUGIN(/Users/user/.ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/Users/user/.ansible.cfg) = /tmp/ansible/facts_cache
CACHE_PLUGIN_TIMEOUT(/Users/user/.ansible.cfg) = 129600
CALLBACKS_ENABLED(/Users/user/.ansible.cfg) = ['ansible.posix.timer']
CONFIG_FILE() = /Users/user/.ansible.cfg
DEFAULT_HOST_LIST(/Users/user/.ansible.cfg) = ['/Users/user/code/riichilab/ansible-roles/hosts.ini']
DEFAULT_LOG_PATH(/Users/user/.ansible.cfg) = /Users/user/.ansible/var/log/ansible.log
DEFAULT_VAULT_IDENTITY_LIST(/Users/user/.ansible.cfg) = ['riichi@~/.ansible/vault', 'mir@~/.ansible/makeitrepeatable']
DEPRECATION_WARNINGS(/Users/user/.ansible.cfg) = False
OS / ENVIRONMENT

controller: MacOS
host: Debian Bookworm

STEPS TO REPRODUCE

If I try to run luks_device against an already-open luks device named 'crypt00', I get a failure.

- name: Ensure encrypted disk is open
  community.crypto.luks_device:
    device: '/dev/sda1'
    name: 'crypt00'
    state: 'opened'
    passphrase: "{{ luks_pw }}"

EXPECTED RESULTS

an "ok" response from ansible, indicating that the device is already open and no actions will be taken

ACTUAL RESULTS

I receive an error (listed below). If I change the name of the luks device to "enc00," the command works as expected. I suspect an issue similar to #409.

"luks_device error: Error while
 creating LUKS on /dev/sda: Cannot exclusively open /dev/sda, device in use.\

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions