From 8e04bf67acdf8ae4be0fa02725901d53a9f5ee8a Mon Sep 17 00:00:00 2001 From: Bob Mader Date: Mon, 2 Dec 2024 09:36:48 -0500 Subject: [PATCH 1/4] shrink_lv_backup_extension is not used anywhere --- roles/shrink_lv/defaults/main.yaml | 1 - 1 file changed, 1 deletion(-) delete mode 100644 roles/shrink_lv/defaults/main.yaml diff --git a/roles/shrink_lv/defaults/main.yaml b/roles/shrink_lv/defaults/main.yaml deleted file mode 100644 index 8d530b7..0000000 --- a/roles/shrink_lv/defaults/main.yaml +++ /dev/null @@ -1 +0,0 @@ -shrink_lv_backup_extension: old From 301d52aca757a141e9e20f31862c09a039a73071 Mon Sep 17 00:00:00 2001 From: Bob Mader Date: Tue, 3 Dec 2024 15:44:40 -0500 Subject: [PATCH 2/4] fix bigboot repeatedly increasing the partition size --- changelogs/fragments/fix_80.yml | 2 ++ roles/bigboot/tasks/do_bigboot_reboot.yml | 12 +++++++++--- roles/initramfs/tasks/main.yml | 16 +++++++++++----- 3 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 changelogs/fragments/fix_80.yml diff --git a/changelogs/fragments/fix_80.yml b/changelogs/fragments/fix_80.yml new file mode 100644 index 0000000..d9cf2c2 --- /dev/null +++ b/changelogs/fragments/fix_80.yml @@ -0,0 +1,2 @@ +bugfixes: + - Fix bigboot repeatedly increasing the partition size diff --git a/roles/bigboot/tasks/do_bigboot_reboot.yml b/roles/bigboot/tasks/do_bigboot_reboot.yml index 1d887e9..a87edee 100644 --- a/roles/bigboot/tasks/do_bigboot_reboot.yml +++ b/roles/bigboot/tasks/do_bigboot_reboot.yml @@ -14,15 +14,21 @@ dest: /usr/lib/dracut/modules.d/99extend_boot/increase-boot-partition.sh mode: '0554' +- name: Configure hook removal reboot cron + ansible.builtin.cron: + name: hook_removal + special_time: reboot + job: '/usr/bin/rm -rf /usr/lib/dracut/modules.d/99extend_boot > /dev/null 2>&1' + - name: Create the initramfs and reboot to run the module vars: initramfs_add_modules: "extend_boot" ansible.builtin.include_role: name: initramfs -- name: Remove dracut extend boot module - ansible.builtin.file: - path: /usr/lib/dracut/modules.d/99extend_boot +- name: Remove hook removal reboot cron + ansible.builtin.cron: + name: hook_removal state: absent - name: Retrieve mount points diff --git a/roles/initramfs/tasks/main.yml b/roles/initramfs/tasks/main.yml index 53c3786..6cb91ea 100644 --- a/roles/initramfs/tasks/main.yml +++ b/roles/initramfs/tasks/main.yml @@ -14,7 +14,7 @@ ansible.builtin.copy: remote_src: true src: /boot/initramfs-{{ initramfs_kernel_version }}.img - dest: /boot/initramfs-{{ initramfs_kernel_version }}.img.{{ initramfs_backup_extension }} + dest: /root/initramfs-{{ initramfs_kernel_version }}.img.{{ initramfs_backup_extension }} mode: "0600" - name: Create a new initramfs with the optional additional modules @@ -22,12 +22,18 @@ ansible.builtin.command: '/usr/bin/dracut {{ ((initramfs_add_modules | length) > 0) | ternary("-a", "") }} "{{ initramfs_add_modules }}" --kver {{ initramfs_kernel_version }} --force' changed_when: true +- name: Configure initramfs restore reboot cron + ansible.builtin.cron: + name: restore_initramfs + special_time: reboot + job: '/usr/bin/mv -f /root/initramfs-{{ initramfs_kernel_version }}.img.{{ initramfs_backup_extension }} /boot/initramfs-{{ initramfs_kernel_version }}.img > /dev/null 2>&1' + - name: Reboot the server ansible.builtin.reboot: post_reboot_delay: "{{ initramfs_post_reboot_delay }}" reboot_timeout: "{{ initramfs_reboot_timeout }}" -- name: Restore previous initramfs - # yamllint disable-line rule:line-length - ansible.builtin.command: '/usr/bin/mv -f /boot/initramfs-{{ initramfs_kernel_version }}.img.{{ initramfs_backup_extension }} /boot/initramfs-{{ initramfs_kernel_version }}.img' - changed_when: true +- name: Remove initramfs restore reboot cron + ansible.builtin.cron: + name: restore_initramfs + state: absent From 0e2ca8cc75db0112cc1bb571ff1bf8f02ce1e1da Mon Sep 17 00:00:00 2001 From: Bob Mader Date: Tue, 3 Dec 2024 15:50:14 -0500 Subject: [PATCH 3/4] ignore line length rule --- roles/initramfs/tasks/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/initramfs/tasks/main.yml b/roles/initramfs/tasks/main.yml index 6cb91ea..51220ef 100644 --- a/roles/initramfs/tasks/main.yml +++ b/roles/initramfs/tasks/main.yml @@ -26,6 +26,7 @@ ansible.builtin.cron: name: restore_initramfs special_time: reboot + # yamllint disable-line rule:line-length job: '/usr/bin/mv -f /root/initramfs-{{ initramfs_kernel_version }}.img.{{ initramfs_backup_extension }} /boot/initramfs-{{ initramfs_kernel_version }}.img > /dev/null 2>&1' - name: Reboot the server From 443d8197a443ad1650a82ba9dc1b588535a7a958 Mon Sep 17 00:00:00 2001 From: Bob Mader Date: Wed, 4 Dec 2024 16:53:04 -0600 Subject: [PATCH 4/4] improve reboot cron clean up --- roles/bigboot/tasks/do_bigboot_reboot.yml | 11 ++++------- roles/initramfs/tasks/main.yml | 11 ++++------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/roles/bigboot/tasks/do_bigboot_reboot.yml b/roles/bigboot/tasks/do_bigboot_reboot.yml index a87edee..6cd6395 100644 --- a/roles/bigboot/tasks/do_bigboot_reboot.yml +++ b/roles/bigboot/tasks/do_bigboot_reboot.yml @@ -16,9 +16,11 @@ - name: Configure hook removal reboot cron ansible.builtin.cron: - name: hook_removal + name: bigboot hook removal + cron_file: bigboot_hook_removal + user: root special_time: reboot - job: '/usr/bin/rm -rf /usr/lib/dracut/modules.d/99extend_boot > /dev/null 2>&1' + job: '(rm -rf /usr/lib/dracut/modules.d/99extend_boot; rm -f /etc/cron.d/bigboot_hook_removal) > /dev/null 2>&1' - name: Create the initramfs and reboot to run the module vars: @@ -26,11 +28,6 @@ ansible.builtin.include_role: name: initramfs -- name: Remove hook removal reboot cron - ansible.builtin.cron: - name: hook_removal - state: absent - - name: Retrieve mount points ansible.builtin.setup: gather_subset: diff --git a/roles/initramfs/tasks/main.yml b/roles/initramfs/tasks/main.yml index 51220ef..5057abe 100644 --- a/roles/initramfs/tasks/main.yml +++ b/roles/initramfs/tasks/main.yml @@ -24,17 +24,14 @@ - name: Configure initramfs restore reboot cron ansible.builtin.cron: - name: restore_initramfs + name: initramfs restore + cron_file: initramfs_restore + user: root special_time: reboot # yamllint disable-line rule:line-length - job: '/usr/bin/mv -f /root/initramfs-{{ initramfs_kernel_version }}.img.{{ initramfs_backup_extension }} /boot/initramfs-{{ initramfs_kernel_version }}.img > /dev/null 2>&1' + job: '(mv -f /root/initramfs-{{ initramfs_kernel_version }}.img.{{ initramfs_backup_extension }} /boot/initramfs-{{ initramfs_kernel_version }}.img; rm -f /etc/cron.d/initramfs_restore) > /dev/null 2>&1' - name: Reboot the server ansible.builtin.reboot: post_reboot_delay: "{{ initramfs_post_reboot_delay }}" reboot_timeout: "{{ initramfs_reboot_timeout }}" - -- name: Remove initramfs restore reboot cron - ansible.builtin.cron: - name: restore_initramfs - state: absent