Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: write storage role fingerprint to /etc/fstab #458

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions tasks/main-blivet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,24 @@
- storage_udevadm_trigger | d(false)
- blivet_output is changed

- name: Check if /etc/fstab is present
stat:
path: /etc/fstab
register: __storage_fstab

- name: Add fingerprint to /etc/fstab if present
lineinfile:
insertbefore: "^#"
firstmatch: true
line: "{{ __str }}"
regexp: "{{ __str }}"
path: /etc/fstab
state: present
vars:
__str: "# system_role:storage"
when:
- __storage_fstab.stat.exists
- blivet_output is changed
rescue:
- name: Failed message
fail:
Expand Down
6 changes: 6 additions & 0 deletions tests/test-verify-volume-fstab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@
- "'mount_options' in storage_test_volume"
- "'mount_point' in storage_test_volume"

- name: Verify fingerprint
assert:
that: __fingerprint in storage_test_fstab.stdout
vars:
__fingerprint: "system_role:storage"

- name: Clean up variables
set_fact:
storage_test_fstab_id_matches: null
Expand Down
Loading