Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,22 @@ variables:
all data on that volume will be removed as part of the process of
adding/removing the encryption layer.

Providing a passphrase or key file lets the role reopen a closed encrypted
volume to inspect its existing filesystem. In check mode, mappings opened for
this inspection are closed again before the module returns, including on
failure. Mappings that were already open are left open. Check mode does not
mount or reformat the filesystem. Failure to close a temporary mapping is
reported as an error.
Comment thread
richm marked this conversation as resolved.
Resolved

The role temporarily masks discovered cryptsetup services during inspection,
including in check mode, and restores their unmasked state in its cleanup block.
Services already masked (persistently or at runtime) are left masked.

When reopening, an unambiguous existing `/etc/crypttab` entry supplies the mapper
name. Conflicting or occupied names cause an error; already-open mappings keep
their names. Reopening does not rewrite crypttab or change LUKS keys or options.
Swap on a mapping opened only for check-mode inspection is not activated.

- `encryption_password`

This string specifies a password or passphrase used to unlock/open the LUKS volume.
Expand Down Expand Up @@ -443,6 +459,43 @@ platforms with "buggy" udev.

```

### Inspect an existing encrypted volume

This example checks an existing encrypted LV using a passphrase supplied by an
encrypted variable file (for example, Ansible Vault). No plaintext passphrase is
stored in the playbook. Alternatively, replace `encryption_password` with
`encryption_key: /root/existing-volume.key`; the key file must already exist on
the managed host.

```yaml
- name: Check an existing encrypted volume
hosts: storage_hosts
check_mode: true
vars:
storage_safe_mode: true
storage_pools:
- name: app
type: lvm
volumes:
- name: secret
encryption: true
encryption_password: "{{ vault_existing_volume_passphrase }}"
mount_point: /srv/secret
tasks:
- name: Inspect storage without logging credential-bearing results
include_role:
name: linux-system-roles.storage
apply:
no_log: true
no_log: true
```

Check mode can temporarily open the closed mapping to inspect its existing
filesystem, but closes that temporary mapping before returning, even on failure.
It does not mount or reformat the filesystem. A mapping that was already open
stays open. Omitting `check_mode: true` applies the declaration normally and leaves
the declared encrypted volume open and mounted.

## rpm-ostree

If you are not managing stratis pools or volumes, remove `stratisd` and
Expand Down
Loading