Skip to content

Commit

Permalink
don't touch grubenv unless needed
Browse files Browse the repository at this point in the history
  • Loading branch information
swapdisk committed Nov 13, 2023
1 parent 41119cb commit 7af5764
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion roles/lvm_snapshots/tasks/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,19 @@
changed_when: true
when: ((lvm_snapshots_new_lvm_config | trim) | length) > 0

- name: Force grubenv saved_entry
- name: Check for grubenv saved_entry

Check failure on line 21 in roles/lvm_snapshots/tasks/create.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

fqcn[action-core]

Use FQCN for builtin module actions (lineinfile).

Check failure on line 21 in roles/lvm_snapshots/tasks/create.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

fqcn[action-core]

Use FQCN for builtin module actions (lineinfile).
lineinfile:
name: /boot/grub2/grubenv
regexp: ^saved_entry=
state: absent
check_mode: true
changed_when: false
failed_when: false
register: grubenv

- name: Add grubenv saved_entry

Check failure on line 31 in roles/lvm_snapshots/tasks/create.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

no-changed-when

Commands should not change things if nothing needs doing.

Check failure on line 31 in roles/lvm_snapshots/tasks/create.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

no-changed-when

Commands should not change things if nothing needs doing.
ansible.builtin.shell: 'grubby --set-default-index=$(grubby --default-index)'
when: grubenv.found is defined and grubenv.found == 0

- name: Create snapshots
community.general.lvol:
Expand Down

0 comments on commit 7af5764

Please sign in to comment.