Compare commits

..

114 Commits

Author SHA1 Message Date
f39fea0f89 Calculate PE size, and subtract from the shrink size; Attempts to fix allocation/pretending size issue 2025-06-23 17:35:28 -04:00
23c7547f32 Restore shrink size to defined value 2025-06-05 10:47:20 -04:00
78902c1371 Remove 4MB from calculated LVB size 2025-06-05 10:26:33 -04:00
8e057342da pvsqueeze restoration 2025-06-05 10:11:02 -04:00
8106b95478 Remove pvsqueeze execution tasks for testing 2025-06-05 04:49:15 -04:00
a3d5c17253 Add functions to filter plugin; Tweaks 2025-06-05 02:51:07 -04:00
5cb1b9d68f Add tasks to capture block size instead of filesystem size 2025-06-04 22:50:46 -04:00
9a9aa83adb Tweaks 2025-06-03 10:23:23 -04:00
53f3dbc6c8 Remove end_host 2025-06-03 10:21:30 -04:00
50faad8c17 . 2025-06-03 10:20:53 -04:00
8b1e65188c Tweaks 2025-06-03 10:15:28 -04:00
68140fc346 Minor tweaks 2025-06-02 13:09:01 -04:00
d0caf12112 Guardrails to ensure we dont run target LV out of space; minor tweaks 2025-06-02 12:28:17 -04:00
37d44db328 Only import playbook if we need to; define defaults 2025-05-27 16:09:26 -04:00
87a8235cc0 Remove end_host; fixes workflow missing variables 2025-05-27 15:06:42 -04:00
7abd1e74e2 Assertion fix 2025-05-27 14:02:13 -04:00
716698202d Refactored for idempotency 2025-05-22 15:52:27 -04:00
e75578352f Task addition for idempotency 2025-05-22 15:26:47 -04:00
5e2ecd4f21 Task name update 2025-05-21 16:53:21 -04:00
16eed5fec5 Refinements 2025-05-15 17:21:50 -04:00
999ab17dfd Refinements 2025-05-12 16:26:37 -04:00
a64abecc65 Fixes to assertion logic, and cleanup of unused stuffs 2025-05-12 14:25:51 -04:00
2d7764c183 Updates 2025-05-07 17:00:48 -04:00
9008c28110 Add debugging 2025-05-05 18:16:24 -04:00
efaf76ff23 Do you work under AAP now? 2025-05-05 09:45:48 -04:00
ff5eeea88b More fixes to the fixes 2025-05-02 17:40:12 -04:00
2c9fcdef5a Fixes to the fixes 2025-05-02 17:25:59 -04:00
155c6e2631 Fixes 2025-05-01 12:25:58 -04:00
07d169f527 Add set stats; comment debugging 2025-04-30 22:32:02 -04:00
a3021ac84e Updates to allow Bigboot to decrement from the default target size, down to a minimum threshold of 1GB 2025-04-30 22:22:11 -04:00
212ace2d6d pvsqueeze.sh update 2025-03-20 15:26:02 -04:00
a4a9c2fa89 Update ReaR restore 2025-03-06 01:08:15 -05:00
2efe662c0e Remove success check; its in the collection now 2025-03-04 17:38:25 -05:00
93d256af80 Task shift 2025-03-04 16:59:18 -05:00
35531c86d7 Removing debugging; probably a sync/timing issue -- gather_facts for nfs_export 2025-03-04 16:44:07 -05:00
51e313692d Add some debugging 2025-03-04 16:07:04 -05:00
91a2423e2e Bleh 2025-03-04 15:45:17 -05:00
0cc014824c Updates to Bigboot ReaR based on updates to ReaR 2025-03-04 15:32:57 -05:00
212a686c90 Updates to Bigboot ReaR based on updates to ReaR 2025-03-04 15:25:00 -05:00
3c05c4cd5d Path fix 2025-03-03 14:42:18 -05:00
da8fda8555 Updates, renames, etc. 2025-02-28 01:11:39 -05:00
09fad57ac6 Add log archive and task shuffle 2025-02-28 00:41:14 -05:00
d583c511bb Vars fix 2025-02-27 23:57:45 -05:00
8cc3e3fd48 Vars cleanup 2025-02-27 23:54:24 -05:00
e0f478e2f9 Task name update 2025-02-27 23:38:32 -05:00
0508017e08 Remove debug 2025-02-27 23:14:31 -05:00
17c95aad22 Add debug 2025-02-27 23:12:55 -05:00
94d53287d0 More logic fixes 2025-02-27 21:32:49 -05:00
a0054be5e6 Logic fixes 2025-02-27 21:16:14 -05:00
b2d6c4467e Variable fixes 2025-02-27 20:34:54 -05:00
2eaeb48fee Fix additional naming issues 2025-02-27 20:26:32 -05:00
29f8064441 Fix variable name causing error 2025-02-27 20:06:25 -05:00
d4561bad99 no_log: false for debugging 2025-02-27 20:01:34 -05:00
4c75f10ec3 Updates for bigboot_rear_backup.yml; Add bigboot_rear_clean.yml 2025-02-27 19:53:26 -05:00
2bce76e413 Remove: Update backup path to include hostname 2025-02-26 17:50:18 -05:00
7c78438d2d Update backup path to include hostname 2025-02-26 16:25:55 -05:00
8417a28302 Provide fsid for Bigboot share; add missing call 2025-02-22 19:52:13 -05:00
b91c7c60fb Provide fsid for Bigboot share 2025-02-22 19:38:40 -05:00
5aa0380c2a Call nfs_export role with backup path defined; fixed 2025-02-22 17:42:11 -05:00
6a9d2833fd Call role with backup path defined; fixed 2025-02-22 17:20:07 -05:00
eca5be5592 Call role with backup path defined 2025-02-22 17:16:39 -05:00
3cc182de09 Updates for the workflow 2025-02-22 17:15:02 -05:00
52854491f2 Remove conditional 2025-02-21 14:33:40 -05:00
238a348a5f Restore Bigboot execution 2025-02-05 15:42:33 -05:00
d64de081f7 Remove Bigboot execution for now...skip straight to failure 2025-02-05 15:36:14 -05:00
f8780d1272 Failures will result in cleanup. Pt 2. 2025-02-05 15:35:17 -05:00
d0888f3737 Failures will result in cleanup. 2025-02-05 15:02:26 -05:00
8e194f9fe5 Re-add local copy of infra.lvm_snapshots so we can better tailor the lab experience 2025-01-31 16:28:01 -05:00
3c5f740320 this was stupid 2025-01-31 16:27:20 -05:00
e343b212fb Re-add local copy of infra.lvm_snapshots so we can better tailor the lab experience 2025-01-31 16:18:55 -05:00
70a9a2e665 Add option to force ReaR backup: draft 2025-01-22 17:20:33 -05:00
be2ee9be1d Add option to force ReaR backup: draft 2025-01-22 17:09:28 -05:00
96c5cbd44c Add option to force ReaR backup: draft 2025-01-22 17:05:07 -05:00
9e94d3425d Add option to force ReaR backup: draft 2025-01-22 17:02:10 -05:00
15a7a3531f Add option to force ReaR backup: draft 2025-01-22 16:58:04 -05:00
5f13492ee4 Remove local copy of infra.lvm_snapshots; Use feature branch version from Github 2025-01-08 17:28:27 -05:00
e68d127845 Update assertion 2025-01-08 15:20:13 -05:00
9c87c1311e Updates to check_device.yml; testing 2025-01-08 15:04:47 -05:00
07e9fac987 Cleanup; testing 2025-01-08 12:42:24 -05:00
0606ff81b2 Finalize development of shrink_lv fix; Testing 2025-01-08 12:38:23 -05:00
078da59120 Add assertion fix to local copy of collection; Fix deployed to Github - needs testing also 2025-01-07 16:57:06 -05:00
d3cf06fbd1 Comment out additional cleanup tasks 2025-01-07 15:10:15 -05:00
493a5758b7 Comment out service checks; This should cause errors initially 2025-01-07 14:54:50 -05:00
6c69d48268 Move to using verified_reboot to manage reboots for Bigboot; infra.lvm_snapshots is local for testing this 2024-11-07 17:28:03 -05:00
e4245dfb58 remove dummy collection 2024-10-18 10:45:52 -04:00
09bcd6347e add dummy collection to test failure 2024-10-18 10:44:53 -04:00
9d53dada64 add script cleanup task 2024-10-18 10:33:26 -04:00
d02a3809cb more task name modification 2024-10-17 15:05:19 -04:00
868b891e09 task name modification 2024-10-17 15:04:53 -04:00
5bd52ff627 change method for deploying and executing pvsqueeze.sh due to environmental issues 2024-10-17 14:33:02 -04:00
af38c279da add pvsqueeze.sh script, and execute it prior to ALL bigboot executions 2024-10-14 14:24:28 -04:00
0076a60651 add bigboot_pv datas... correctly now 2024-10-14 12:11:41 -04:00
73c8171bbe add bigboot_pv datas 2024-10-14 12:00:41 -04:00
82da0dd6ac add bigboot_cleanup.yml playbook 2024-09-12 18:07:42 -04:00
ca0ecb570d add bigboot_rear_restore.yml playbook 2024-09-11 16:16:16 -04:00
fde58e368d Check connectivity to NFS servers and update exports accordingly on those which succeed the connection 2024-09-10 21:52:35 -04:00
2bf5969f51 Add default 2024-08-29 21:49:59 -04:00
a02753e91f Update collection reference 2024-08-29 18:08:07 -04:00
f2e6dcc9e5 Add fsck cleanup to cleanup.yml; comment out pre-checks for now 2024-08-27 15:33:07 -04:00
7b447e0fd2 Use bigboot_size_target instead of the calculated size diff 2024-08-20 17:38:13 -04:00
7ad8d715af Update collection reference 2024-08-20 17:29:45 -04:00
b0e94aba64 Fix variable references 2024-08-20 14:54:36 -04:00
3b8624fea8 Fix variable references 2024-08-20 14:36:56 -04:00
d41609c832 Merge pull request 'Sync with upstream release 2.1.0' (#6) from wip into develop
Reviewed-on: #6
2024-08-20 14:22:16 -04:00
80c1e0a09c Revert changes which are not needed 2024-08-20 14:20:02 -04:00
862908fe0c Sync with develop branch 2024-08-20 14:12:31 -04:00
035fc1b57c Add initial pre-checks 2024-08-19 17:53:08 -04:00
9f9a798d91 more task rename; block remove 2024-08-07 10:57:30 -04:00
677ba57401 more task rename 2024-08-07 10:54:20 -04:00
2a8ce9fa89 task rename 2024-08-07 10:51:40 -04:00
684c1bef51 cleanup and add code block 2024-08-07 10:17:05 -04:00
e7e90aaaf5 cleanup 2024-08-06 11:47:21 -04:00
aba39cbad4 new service state handling 2024-08-06 11:30:30 -04:00
fa7f4d0e31 sync with upstream; re-work in progress 2024-07-16 15:19:12 -04:00
61 changed files with 846 additions and 888 deletions

1
.gitignore vendored
View File

@ -11,3 +11,4 @@ collections/ansible_collections/rhc*
roles/autofsck
roles/verified_reboot
*.bak
tasks/check_space_fallback_local.yml

View File

@ -14,6 +14,7 @@ timeout = 30
host_key_checking = false
display_skipped_hosts = false
deprecation_warnings = false
show_custom_stats = true
# callback_whitelist is deprecated
# we only include here for backwards compatibility

View File

@ -1,27 +0,0 @@
---
- name: Perform logical volume and boot parition resizing as needed
hosts: all
become: true
gather_facts: true
strategy: free
vars_files:
- bigboot_vars.yml
tasks:
- name: Cleanup from any previous executions
ansible.builtin.import_tasks: tasks/cleanup.yml
- name: Shrink the logical volume to support /boot expansion
ansible.builtin.import_role:
name: infra.lvm_snapshots.shrink_lv
vars:
shrink_lv_devices:
- device: "/dev/mapper/system-root"
size: "53687091200"
- name: Expand the /boot partition as requested
ansible.builtin.import_role:
name: infra.lvm_snapshots.bigboot
vars:
bigboot_partition_size: "{{ bigboot_size_target }}"

View File

@ -56,4 +56,14 @@
ansible.builtin.import_role:
name: infra.lvm_snapshots.bigboot
vars:
bigboot_partition_size: "{{ bigboot_size_target }}"
bigboot_partition_size: "{{ bigboot_data[inventory_hostname]['bigboot_size_target'] }}"
- name: Failure on request
ansible.builtin.fail:
msg: "Ansible job has been failed upon request."
when:
- bigboot_fail_request | default(false) | bool
rescue:
- name: Cleanup from any previous executions
ansible.builtin.import_tasks: tasks/cleanup.yml

View File

@ -1,6 +1,27 @@
---
- name: Perform a ReaR backup before the /boot expansion
ansible.builtin.import_playbook: rhc.rear.rear_backup
when:
- bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | default(false) | bool
- not rear_backup_skip | default(false) | bool
- name: ReaR Backup Playbook
hosts: all
become: true
gather_facts: true
strategy: free
vars_files:
- bigboot_vars.yml
tasks:
- name: Import rear_vars role
ansible.builtin.import_role:
name: rhc.rear.rear_vars
- name: Fetch the template name from NFS exports
ansible.builtin.set_fact:
job_template_name: "{{ nfs_exports_template_name }}"
- name: Perform ReaR Backup
when:
- bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | default(false) | bool
- not rear_backup_skip | default(false) | bool
block:
- name: Perform ReaR backup
ansible.builtin.include_role:
name: rhc.rear.rear_backup

6
bigboot_rear_clean.yml Normal file
View File

@ -0,0 +1,6 @@
---
- name: Cleanup ReaR artifacts on successful Bigboot
ansible.builtin.import_playbook: rhc.rear.rear_remove
when:
- bigboot_data[inventory_hostname]['bigboot_execute_bigboot'] | default(false) | bool
- not rear_backup_skip | default(false) | bool

View File

@ -24,17 +24,22 @@
- name: Update NFS exports on reachable servers
hosts: reachable_hosts
become: true
gather_facts: false
gather_facts: true
vars_files:
- bigboot_vars.yml
tasks:
- name: Import rear_vars role
ansible.builtin.import_role:
name: rhc.rear.rear_vars
- name: Grab the template name
ansible.builtin.set_stats:
aggregate: false
per_host: false
data:
nfs_exports_template_name: "{{ tower_job_template_name }}"
aggregate: true
- name: Create IP list and add to NFS exports
ansible.builtin.include_tasks: tasks/rear_nfs_exports.yml
@ -44,4 +49,3 @@
when:
- item['value']['bigboot_execute_bigboot'] | default(false) | bool
- not rear_backup_skip | default(false) | bool

View File

@ -1,5 +1,5 @@
---
- name: Execute a ReaR restore and restore system to pre-Bigboot state
- name: Execute ReaR restore
hosts: all
become: true
gather_facts: true
@ -9,8 +9,12 @@
- bigboot_vars.yml
tasks:
- name: Shrink the logical volume to support /boot expansion
- name: Import rear_vars role
ansible.builtin.import_role:
name: rhc.rear.rear_vars
- name: Restore from ReaR backup
ansible.builtin.include_role:
name: rhc.rear.rear_restore
- name: Cleanup from any previous executions

View File

@ -12,19 +12,13 @@
- name: Cleanup from any previous executions
ansible.builtin.import_tasks: tasks/cleanup.yml
# - name: Check for services that require being disabled
# ansible.builtin.import_tasks: tasks/check_services.yml
- name: Set boot device details
ansible.builtin.import_tasks: tasks/capture_boot_device_details.yml
- name: Set logical volume information
ansible.builtin.import_tasks: tasks/capture_lv_device_details.yml
# - name: Run pre-checks to verify environment
# ansible.builtin.import_tasks: tasks/pre-checks.yml
# when:
# - bigboot_execute_bigboot | bool
when:
- bigboot_execute_bigboot | default(false) | bool
- name: Set environment for subsequent workflow nodes
ansible.builtin.set_stats:
@ -34,10 +28,11 @@
combine({inventory_hostname:
{
'bigboot_execute_bigboot': bigboot_execute_bigboot,
'bigboot_execute_shrink_lv': bigboot_execute_shrink_lv,
'bigboot_adjacent_lvm_device': bigboot_adjacent_lvm_device,
'bigboot_lv_shrink_size': bigboot_lv_shrink_size | int,
'bigboot_pv': bigboot_pv,
'bigboot_execute_shrink_lv': bigboot_execute_shrink_lv | default(false),
'bigboot_adjacent_lvm_device': bigboot_adjacent_lvm_device | default(omit),
'bigboot_lv_shrink_size': bigboot_lv_shrink_size | default(0) | int,
'bigboot_pv': bigboot_pv | default(omit),
'bigboot_size_target': bigboot_size_target_fallback | default(bigboot_size_target),
'ip_addresses': ansible_all_ipv4_addresses,
'server_hostname': ansible_hostname
}

View File

@ -1,8 +0,0 @@
download_url: https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/infra-lvm_snapshots-2.1.0.tar.gz
format_version: 1.0.0
name: lvm_snapshots
namespace: infra
server: https://galaxy.ansible.com/api/
signatures: []
version: 2.1.0
version_url: /api/v3/plugin/ansible/content/published/collections/index/infra/lvm_snapshots/versions/2.1.0/

View File

@ -0,0 +1,5 @@
---
exclude_paths:
- .github
- changelogs
...

View File

@ -0,0 +1 @@
inventory.yml

View File

@ -0,0 +1,78 @@
[MESSAGES CONTROL]
disable=
# "F" Fatal errors that prevent further processing
# import-error,
# "I" Informational noise
# "E" Error for important programming issues (likely bugs)
# no-member,
# no-name-in-module,
# raising-bad-type,
# "W" Warnings for stylistic problems or minor programming issues
# no-absolute-import,
# arguments-differ,
# cell-var-from-loop,
# fixme,
; lost-exception,
; no-init,
; pointless-string-statement,
; protected-access,
; redefined-outer-name,
; relative-import,
; undefined-loop-variable,
; unsubscriptable-object,
# unused-argument,
; unused-import,
; unspecified-encoding,
# "C" Coding convention violations
; bad-continuation,
; missing-docstring,
; wrong-import-order,
; use-maxsplit-arg,
; consider-using-dict-items,
; consider-using-enumerate,
# "R" Refactor recommendations
; duplicate-code,
; no-self-use,
; too-few-public-methods,
; too-many-branches,
; too-many-locals,
; too-many-statements,
; consider-using-from-import,
; use-list-literal,
; use-dict-literal,
# new for python3 version of pylint
; useless-object-inheritance,
; consider-using-set-comprehension, # pylint3 force to use comprehension in place we don't want (py2 doesn't have these options, for inline skip)
; unnecessary-pass,
; invalid-envvar-default, # pylint3 warnings envvar returns str/none by default
; bad-option-value, # python 2 doesn't have import-outside-toplevel, but in some case we need to import outside toplevel
; super-with-arguments, # required in python 2
; raise-missing-from, # no 'raise from' in python 2
; use-a-generator, # cannot be modified because of Python2 support
; consider-using-with, # on bunch spaces we cannot change that...
; duplicate-string-formatting-argument, # TMP: will be fixed in close future
consider-using-f-string, # sorry, not gonna happen, still have to support py2
; use-dict-literal
[FORMAT]
# Maximum number of characters on a single line.
max-line-length=120
[DESIGN]
max-args=11 # 2x + 1 from default
max-attributes=21 # 4x + 1 from default
[REPORTS]
msg-template='[{msg_id} {symbol}] {msg} File: {path}, line {line}, in {obj}'
[BASIC]
# In order to make a check more strict add proper regex http://pylint-messages.wikidot.com/messages:c0103
argument-rgx=.*
attr-rgx=.*
class-rgx=.*
const-rgx=.*
function-rgx=.*
method-rgx=.*
module-rgx=.*
variable-rgx=.*
inlinevar-rgx=.*

View File

@ -0,0 +1,4 @@
rules:
indentation:
spaces: 2
indent-sequences: false

View File

@ -4,6 +4,36 @@ LVM Snapshot Linux Role Release Notes
.. contents:: Topics
v2.1.1
======
Minor Changes
-------------
- Improve documentation and example usage of initramfs role
- Improved console logging of bigboot progress to include percent complete
- Support check mode when using the bigboot role
Bugfixes
--------
- Fix bigboot repeatedly increasing the partition size
v2.1.0
======
Major Changes
-------------
- add bigboot support for Btrfs next partition
Minor Changes
-------------
- do bigboot LVM changes with Ansible instead of pre-mount hook
- new bigboot_partition_size variable to make bigboot role more idempotent
- show console log output from bigboot even if quiet kernel arg is set
v2.0.3
======

View File

@ -1,670 +0,0 @@
{
"files": [
{
"name": ".",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/snapshot_remove",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/snapshot_remove/tasks",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/snapshot_remove/tasks/main.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "509ab8a1e07e4d71837884e88d8190ef13f58745ee10a8ade71e73e788308087",
"format": 1
},
{
"name": "roles/snapshot_remove/README.md",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "5e2d063f1f2eb572281101338b21d84d0ec3cf171a7ade4cf456c54179f4f2e6",
"format": 1
},
{
"name": "roles/snapshot_remove/meta",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/snapshot_remove/meta/main.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "606e6e273462d94697558655fa3bfb1491e3474b112bd1e3a549115d50b44632",
"format": 1
},
{
"name": "roles/initramfs",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/initramfs/tasks",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/initramfs/tasks/preflight.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "b1418bba68bd83500aee8fb067562e4cae27dd1c6585d74938f1d3b15a5c575a",
"format": 1
},
{
"name": "roles/initramfs/tasks/main.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "6e33876d82d59a25393985cd9948ee16b6ab29a7585c8ba2b30197ab16f7a767",
"format": 1
},
{
"name": "roles/initramfs/README.md",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "c628601c9a2f5c904131e0dc9c0e79f3c6f189b30bf64de651d95986f9bb9f02",
"format": 1
},
{
"name": "roles/initramfs/meta",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/initramfs/meta/main.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "825f9c7e7b25072c135162acead4ed57c8ab270b3dabc7b7eb626b6d35bdb050",
"format": 1
},
{
"name": "roles/initramfs/defaults",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/initramfs/defaults/main.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "f201653d875b43e7915feb027605fc95b1955debe5535f131ac07821fb6bc878",
"format": 1
},
{
"name": "roles/snapshot_revert",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/snapshot_revert/tasks",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/snapshot_revert/tasks/main.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "5c80af9b54761322d9c7fb7a5366f32784d455f417aa05545f64e8efd3350b08",
"format": 1
},
{
"name": "roles/snapshot_revert/tasks/verify_snapshot_active.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "339d8c553502c3807457f2c3f9f7e8bfb136d260e73cc9e87e1990befacb69a5",
"format": 1
},
{
"name": "roles/snapshot_revert/README.md",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "5d4174b8205d0a5c8c900a57260fd6ae66b84cdffd698eb44048bbfa58b2cff0",
"format": 1
},
{
"name": "roles/snapshot_revert/meta",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/snapshot_revert/meta/main.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "642e5210da82a46d6bf143c0dfcb40af3866057defe55e9cf268a2ff6a1e892e",
"format": 1
},
{
"name": "roles/snapshot_create",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/snapshot_create/tasks",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/snapshot_create/tasks/create.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "4be981713a7b7c9b784fb60170c3aea095073cd35d591cca006a782f0f7b7356",
"format": 1
},
{
"name": "roles/snapshot_create/tasks/check.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "d9fb57d25714b52d131ac49fc3471dd0e78a29fe39b4e853a880a8007ef92ca8",
"format": 1
},
{
"name": "roles/snapshot_create/tasks/verify_volume_exists.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "87fb805b1619aa98d312deb540775a14c3282b6f4515ecdeaa1690fa51e73339",
"format": 1
},
{
"name": "roles/snapshot_create/tasks/main.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "47495cf552f5c4038303911f8f7786a41c6397cea379ab0d70cb76fe015ebe10",
"format": 1
},
{
"name": "roles/snapshot_create/tasks/verify_no_existing_snapshot.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "724a282c30555bd9e0950675885999537b9200de1e7823509f583f09195a938d",
"format": 1
},
{
"name": "roles/snapshot_create/README.md",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "7c6e97382311dfee2ae894ad656fbe292a17d54c9029e5ce07c1587e09fe9c14",
"format": 1
},
{
"name": "roles/snapshot_create/files",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/snapshot_create/files/check.py",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "911f7680558f08a7bd2d415a250e7e2b7d60aef2a633f0ce4d6bfa87b08db076",
"format": 1
},
{
"name": "roles/snapshot_create/meta",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/snapshot_create/meta/main.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "d0c9faaf48633e7d073817625fbf0d95f975c69dd2201b99c52f557e15c6431e",
"format": 1
},
{
"name": "roles/snapshot_create/defaults",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/snapshot_create/defaults/main.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "25d6004aad8f7ffa6417bb5be7e28a7c06f22c641ce4b66ef31afc67bc972312",
"format": 1
},
{
"name": "roles/shrink_lv",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/shrink_lv/templates",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/shrink_lv/templates/shrink-start.sh.j2",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "aa1864ed4b3767f2c75b984d80a8a80667e0bbdba43ef049f03e9abbd4f6b030",
"format": 1
},
{
"name": "roles/shrink_lv/tasks",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/shrink_lv/tasks/preflight.yaml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "97eb164e678d888f95513079d7d22001b0af23a17899b94bd82cafba3808eea1",
"format": 1
},
{
"name": "roles/shrink_lv/tasks/main.yaml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "2717ed24e19652be68fe5120f22f77e7b5fea969b8cb97257d77302710f0417d",
"format": 1
},
{
"name": "roles/shrink_lv/tasks/check_device.yaml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "201415597a64407c404134452f90b7ffe62370e10c245040cffb5c3be7d4ac2c",
"format": 1
},
{
"name": "roles/shrink_lv/README.md",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "4da5f48565753fcfac29f1856454085f503c207578eb6c58d750e2c76baedcbb",
"format": 1
},
{
"name": "roles/shrink_lv/files",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/shrink_lv/files/shrink.sh",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "1bdf2d37411ea35c3e91c6427677775fee37c783bfb948d55cbfc6e11a0c89aa",
"format": 1
},
{
"name": "roles/shrink_lv/files/module-setup.sh",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "b0b9d303e9b2ce57ce4b6e8ee801471b7ae2763d65912677ce2c6f6d1d2c3f09",
"format": 1
},
{
"name": "roles/shrink_lv/meta",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/shrink_lv/meta/main.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "31e41f67bd856b5055e161e55c013397a145d3170c612bd7999fd2e9a3706526",
"format": 1
},
{
"name": "roles/shrink_lv/defaults",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/shrink_lv/defaults/main.yaml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "ad38f2c50795ab06e4b13ffd6b78083c72508efc60e90681a85e2eb29f474a19",
"format": 1
},
{
"name": "roles/bigboot",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/bigboot/templates",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/bigboot/templates/increase-boot-partition.sh.j2",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "3a2850a945c6e14103b119713f8b0e0d7d5c58dcf9853cb80587cdbb49e75a72",
"format": 1
},
{
"name": "roles/bigboot/tasks",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/bigboot/tasks/prep_lvm.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "e7ef8b4e143d1f04a71a91438606d8d5ef61186169dffa0661cdac5ac65c7c5d",
"format": 1
},
{
"name": "roles/bigboot/tasks/prep_btrfs.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "e51169ec2589645540a59d49e91d35790d1f04bd60b9d2e0498d26a115bcbbf4",
"format": 1
},
{
"name": "roles/bigboot/tasks/get_boot_device_info.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "6fefba635d26df89f1cf4308f93f82ead07e457e13d8a45c3eaa532c1338f9e7",
"format": 1
},
{
"name": "roles/bigboot/tasks/do_bigboot_reboot.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "342d2c4bbd4d91590e62984ee7d4ed78cb5ca97e6970a7a4d071839e89cf46c5",
"format": 1
},
{
"name": "roles/bigboot/tasks/main.yaml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "dbd58033393e580312d40e2fed7a3dda261f26e8393d28830205c89b4b24c3a5",
"format": 1
},
{
"name": "roles/bigboot/README.md",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "a8a1734d9f3803f6ccae7eb57531d04caf2da1be0adcfa41ed6c4d9b25dd85e1",
"format": 1
},
{
"name": "roles/bigboot/files",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/bigboot/files/module-setup.sh",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "0a3130bbbbda27623f91f00735285641f7480b75201df8f8252bc0b0e1215bfb",
"format": 1
},
{
"name": "roles/bigboot/files/bigboot.sh",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "17e3dde12e2b102eb2eca1a11f2a62e0e4b6d8b982c75da0a2dd194bf8be3122",
"format": 1
},
{
"name": "roles/bigboot/files/sfdisk.static",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "aebb9ea3b54f739dafef4b2e581ffbc6c72847487ba0dd6b1c7fceb26277985d",
"format": 1
},
{
"name": "roles/bigboot/meta",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/bigboot/meta/main.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "fafb7ac1801552bafb0a71a6d5ddea32ba4699acaa179a32689f316b47d7db07",
"format": 1
},
{
"name": "roles/bigboot/defaults",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "roles/bigboot/defaults/main.yaml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "2546f99a2ca7a0a9a7fc93efdb989581d5ae6b8c5dae798877fb6bbf48f597de",
"format": 1
},
{
"name": "CONTRIBUTING.md",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "b380120df01b9bdb8d8a9db37688f9ca2d56de8d65fa26503156a6819371d487",
"format": 1
},
{
"name": "README.md",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "ff0b7f4f22711076d82f03cf5f6fc77f947a4d4756e1292c9d1b9af116a2f935",
"format": 1
},
{
"name": "LICENSE",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "aa611f74dc5804197879f24d3f192f438845fae8e1dda9053e8637fccda0d05a",
"format": 1
},
{
"name": "changelogs",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "changelogs/.plugin-cache.yaml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "17bc457386b91d2469190e384af050f297d4109710d57bf686400ab53bab4c99",
"format": 1
},
{
"name": "changelogs/config.yaml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "7d9693a308a709ae4d30cde6a08ed9ebd9cd6f1222aa251c44e6122ea84a50d3",
"format": 1
},
{
"name": "changelogs/fragments",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "changelogs/fragments/.gitkeep",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"format": 1
},
{
"name": "changelogs/fragments/more_idempotent.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "2d436efd751cff9c1d021f6af4ef405cbf8182fdcb169e1873ff8e8735404fff",
"format": 1
},
{
"name": "changelogs/fragments/btrfs_bigboot.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "3871d625e89227e10bd82c3a9ba3a16f5ff8f1d86887782f3ff971e13ac8e7f1",
"format": 1
},
{
"name": "changelogs/changelog.yaml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "dcde0629116149ea3e53f2ea71ea4195c3dd560266cad9b28737cc1c424cd755",
"format": 1
},
{
"name": ".github",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": ".github/workflows",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": ".github/workflows/pylint.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "af052a539c6b2dcfa7c8388c599e9f0bc58b72f90ea1ad3f958a2e9f6c32a234",
"format": 1
},
{
"name": ".github/workflows/ansible-lint.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "52b5b419c651b390716392600738b63b75d5b4431c127dab064fd39762cdf9f1",
"format": 1
},
{
"name": ".github/workflows/shellcheck.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "2b8a5ab122a75643a2941d2fea2b876c8ef55f6eff41b20896e4ede9e76788c8",
"format": 1
},
{
"name": ".github/workflows/codespell.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "de7825f066c930358517755935e05df6ac8a4566df9a4a7affc7ec8c12d64a77",
"format": 1
},
{
"name": ".github/workflows/release.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "12387e85a382cf64ac8eed9e9c1282ae15e1d38c087efbc64f6ee16b7953367d",
"format": 1
},
{
"name": ".github/workflows/pycodestyle.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "016e1649c987f5265f14bbffd125e9cffdabb8a0adac1eb49fac556b3ca157d3",
"format": 1
},
{
"name": "CHANGELOG.rst",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "6a37c02d6aa4fce47aa56689a5e9c0c1f681f65479ae589732017edab3e318aa",
"format": 1
},
{
"name": "CODEOWNERS",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "a2277cb0ecb46693ddba53cff778757052e73481e7ac2cf623f1a3e327913117",
"format": 1
},
{
"name": ".pycodestyle",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "9bc6971355aed1f873d5daa68c393c84fa3c8ef26f71c975f4fd8afa3b690156",
"format": 1
},
{
"name": "meta",
"ftype": "dir",
"chksum_type": null,
"chksum_sha256": null,
"format": 1
},
{
"name": "meta/runtime.yml",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "16fee19238e61fab14a7974fd79800cd659367bbc8b052d9f0b190108f6a2c53",
"format": 1
}
],
"format": 1
}

View File

@ -1,35 +0,0 @@
{
"collection_info": {
"namespace": "infra",
"name": "lvm_snapshots",
"version": "2.1.0",
"authors": [
"Ygal Blum <yblum@redhat.com>",
"Bob Mader <bob@redhat.com>"
],
"readme": "README.md",
"tags": [
"ansible",
"lvm",
"storage"
],
"description": "Ansible role for creating and rolling back LVM snapshots",
"license": [],
"license_file": "LICENSE",
"dependencies": {
"community.general": "*"
},
"repository": "https://github.com/redhat-cop/infra.lvm_snapshots",
"documentation": "https://github.com/redhat-cop/infra.lvm_snapshots",
"homepage": "https://github.com/redhat-cop/infra.lvm_snapshots",
"issues": "https://github.com/redhat-cop/infra.lvm_snapshots/issues"
},
"file_manifest_file": {
"name": "FILES.json",
"ftype": "file",
"chksum_type": "sha256",
"chksum_sha256": "d5511e77f16eea344fcd5c4f879eae5752db76b5cdfc848ea541b2d8d02727bc",
"format": 1
},
"format": 1
}

View File

@ -0,0 +1,13 @@
# Bigboot Stickers
I presented a lightning talk at Red Hat Summit 2024 giving an overview and demo of the [`bigboot`](./roles/bigboot/) role. To help drive engagement and add some excitement, I had 100 of these stickers printed up. The talk was well received and all the stickers were given away.
![People grabbing stickers after my talk](images/bobtalk.jpg)
Since then, lots of folks asked me if there are more stickers. Well, I recently discovered how to make them available for folks to order at Sticker Mule. You can get 10 stickers for 9.99 USD. These are nice die cut stickers measuring 2.29" x 3" (58mm x 76mm). They are available with [plain white vinyl](https://www.stickermule.com/swapdisk/item/14744765) the same as the ones I gave away or with this [fancy pants holigraphic background](https://www.stickermule.com/swapdisk/item/17024469) that looks really cool.
![Bigboot stickers in white and holographic](images/bigboot-stickers.png)
If you have the means to print your own stickers or just want the source artwork, download the 1200 dpi image file [here](images/bigboot-sticker-transbg-1200dpi.png).
Add some bling to your laptop lid today and share with your friends. Cheers!

View File

@ -16,4 +16,4 @@ plugins:
strategy: {}
test: {}
vars: {}
version: 2.0.3
version: 2.1.1

View File

@ -122,3 +122,29 @@ releases:
- fix_image_copy.yml
- fix_lvm_config.yml
release_date: '2024-04-25'
2.1.0:
changes:
major_changes:
- add bigboot support for Btrfs next partition
minor_changes:
- do bigboot LVM changes with Ansible instead of pre-mount hook
- new bigboot_partition_size variable to make bigboot role more idempotent
- show console log output from bigboot even if quiet kernel arg is set
fragments:
- btrfs_bigboot.yml
- more_idempotent.yml
release_date: '2024-07-15'
2.1.1:
changes:
bugfixes:
- Fix bigboot repeatedly increasing the partition size
minor_changes:
- Improve documentation and example usage of initramfs role
- Improved console logging of bigboot progress to include percent complete
- Support check mode when using the bigboot role
fragments:
- 78-improve-bigboot-check-mode.yml
- bigboot_progress_meter.yml
- fix_80.yml
- initramfs_docs.yml
release_date: '2024-12-10'

View File

@ -0,0 +1,2 @@
minor_changes:
- Prevent snapshot creation when newest installed kernel is not in use

View File

@ -0,0 +1,3 @@
minor_changes:
- Updates to support hosts with bind/overlay mounts attached
to the device intended to be operated on.

View File

@ -1,5 +0,0 @@
major_changes:
- add bigboot support for Btrfs next partition
minor_changes:
- show console log output from bigboot even if quiet kernel arg is set
- do bigboot LVM changes with Ansible instead of pre-mount hook

View File

@ -1,2 +0,0 @@
minor_changes:
- new bigboot_partition_size variable to make bigboot role more idempotent

View File

@ -0,0 +1,31 @@
---
namespace: infra
name: lvm_snapshots
version: 2.1.1
readme: README.md
authors:
- Ygal Blum <yblum@redhat.com>
- Bob Mader <bob@redhat.com>
description: Ansible role for creating and rolling back LVM snapshots
license_file: LICENSE
tags:
- ansible
- lvm
- storage
dependencies:
"community.general": "*"
repository: https://github.com/redhat-cop/infra.lvm_snapshots
documentation: https://github.com/redhat-cop/infra.lvm_snapshots
homepage: https://github.com/redhat-cop/infra.lvm_snapshots
issues: https://github.com/redhat-cop/infra.lvm_snapshots/issues
build_ignore:
- .ansible-lint
- .pylintrc
- .yamllint
- .git
- .gitignore
- ansible.cfg
- requirements.yml
- tests
- vendor
...

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 KiB

View File

@ -0,0 +1,4 @@
---
collections:
- name: community.general
...

View File

@ -10,10 +10,12 @@ The role configures a dracut pre-mount hook that executes during a reboot to inc
> **WARNING!**
>
> All blocks of the partition above the boot partition are copied using `sfdisk` during the reboot and this can take several minutes or more depending on the size of that partition. The bigboot script periodically outputs progress messages to the system console to make it clear that the system is not in a "hung" state, but these progress messages may not be seen if `rhgb` or `quiet` kernel arguments are set. If the system is reset while the blocks are being copied, the partition will be irrcoverably corrupted. Do not assume the system is hung or force a reset during the bigboot reboot!
> All blocks of the partition above the boot partition are copied using `sfdisk` during the reboot and this can take several minutes or more depending on the size of that partition. The bigboot script periodically outputs progress messages to the system console to make it clear that the system is not in a "hung" state, but these progress messages may not be seen if `rhgb` or `quiet` kernel arguments are set. If the system is reset while the blocks are being copied, the partition will be irrecoverably corrupted. Do not assume the system is hung or force a reset during the bigboot reboot!
To learn more about how bigboot works, check out this [video](https://people.redhat.com/bmader/bigboot-demo.mp4).
Get bigboot stickers for your laptop [here](../../STICKERS.md).
## Role Variables
### `bigboot_partition_size` (String)

View File

@ -71,10 +71,18 @@ if ! ret=$(echo Yes | /usr/sbin/parted "$boot_disk_device" ---pretend-input-tty
fi
# Output progress messages to help impatient operators recognize the server is not "hung"
( sleep 4
while t="$(ps -C sfdisk -o cputime=)"; do
echo "$name: Partition move is progressing, please wait! ($t)"
sleep 120
( sleep 9
while pid="$(ps -C sfdisk -o pid:1=)"; do
pct='??'
for fd in /proc/"$pid"/fd/*; do
if [[ "$(readlink "$fd")" == "$boot_disk_device" ]]; then
offset="$(awk '/pos:/ {print $2}' /proc/"$pid"/fdinfo/"${fd##*/}")"
pct="$((-100*offset/next_part_size+100))"
break
fi
done
echo "$name: Partition move is progressing, please wait! ($pct% complete)"
sleep 20
done ) &
# Shift next partition

View File

@ -14,17 +14,20 @@
dest: /usr/lib/dracut/modules.d/99extend_boot/increase-boot-partition.sh
mode: '0554'
- name: Configure hook removal reboot cron
ansible.builtin.cron:
name: bigboot hook removal
cron_file: bigboot_hook_removal
user: root
special_time: reboot
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:
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
state: absent
- name: Retrieve mount points
ansible.builtin.setup:
gather_subset:
@ -46,3 +49,4 @@
Boot filesystem size is now
{{ bigboot_boot_fs_new_size | int | human_readable }}
({{ (bigboot_boot_fs_new_size | int - bigboot_boot_fs_original_size | int) | human_readable }} increase)
when: not ansible_check_mode

View File

@ -15,6 +15,7 @@
-o vg_extent_size {{ bigboot_next_partition_vg }}
changed_when: false
register: vg_extent_size
check_mode: false
- name: Align bigboot increase to extent size
ansible.builtin.set_fact:

View File

@ -6,8 +6,7 @@ The role is designed to be internal for this collection and support the automati
## Contents
To allow fast fail, the role provides a [`preflight.yml`](./tasks/preflight.yml) tasks file to be used at the start of the playbook.
Please note that the [`main`](./tasks/main.yml) task file will not run the preflight checks
To allow fast fail, the role provides a [`preflight.yml`](./tasks/preflight.yml) tasks file that should be included early in the play that ultimately includes the [`main`](./tasks/main.yml) role that actually reboots the host. Refer the usage section below for example.
## Role Variables
@ -15,8 +14,8 @@ All variables are optional
### `initramfs_add_modules`
`initramfs_add_modules` is a a space-separated list of dracut modules to be added to the default set of modules.
See [`dracut`](https://man7.org/linux/man-pages/man8/dracut.8.html) `-a` parameter for details.
`initramfs_add_modules` is a space-separated list of dracut modules to be added to the default set of modules.
See [`dracut --add`](https://man7.org/linux/man-pages/man8/dracut.8.html) option for details.
### `initramfs_backup_extension`
@ -39,21 +38,54 @@ The value is used for [`reboot_timeout`](https://docs.ansible.com/ansible/latest
Defaults to `7200`
## Example of a playbook to run the role
The following yaml is an example of a playbook that runs the role against a group of hosts named `rhel` and increasing the size of its boot partition by 1G.
The boot partition is automatically retrieved by the role by identifying the existing mounted partition to `/boot` and passing the information to the script using the `kernel_opts`.
## Example role usage
We will refer to the `bigboot` role of this collection to explain how the `initramfs` role can be used. Let's look at the `tasks/main.yaml` of the `bigboot` role. After the required facts have been gathered, the [Validate initramfs preflight](https://github.com/redhat-cop/infra.lvm_snapshots/blob/2.1.0/roles/bigboot/tasks/main.yaml#L10-L13) task includes the `initramfs` role preflight tasks:
```yaml
- name: Extend boot partition playbook
hosts: all
tasks:
- name: Validate initramfs preflight
ansible.builtin.include_role:
name: initramfs
tasks_from: preflight
- name: Create the initramfs and reboot to run the module
vars:
initramfs_add_modules: "my_extra_module"
ansible.builtin.include_role:
name: initramfs
- name: Validate initramfs preflight
ansible.builtin.include_role:
name: initramfs
tasks_from: preflight
```
If this is successful, the `bigboot` role continues to perform additional tasks and checks specific to its function. With that done, it moves on to `tasks/do_bigboot_reboot.yml` which [configures a dracut pre-mount hook](https://github.com/redhat-cop/infra.lvm_snapshots/blob/2.1.0/roles/bigboot/tasks/do_bigboot_reboot.yml#L1-L15) to prepare for the customized initramfs reboot:
```yaml
- name: Copy dracut pre-mount hook files
ansible.builtin.copy:
src: "{{ item }}"
dest: /usr/lib/dracut/modules.d/99extend_boot/
mode: "0554"
loop:
- bigboot.sh
- module-setup.sh
- sfdisk.static
- name: Resolve and copy pre-mount hook wrapper script
ansible.builtin.template:
src: increase-boot-partition.sh.j2
dest: /usr/lib/dracut/modules.d/99extend_boot/increase-boot-partition.sh
mode: '0554'
```
After that, it [includes](https://github.com/redhat-cop/infra.lvm_snapshots/blob/2.1.0/roles/bigboot/tasks/do_bigboot_reboot.yml#L17-L21) the main `initramfs` role which will create a custom initramfs built with the dracut hook configured above, reboot the host to run the hook, and lastly, restore the original initramfs after the reboot:
```yaml
- name: Create the initramfs and reboot to run the module
vars:
initramfs_add_modules: "extend_boot"
ansible.builtin.include_role:
name: initramfs
```
Also, note that while the `initramfs` role handles restoring the original initramfs, it is up to the including play to clean up the dracut hook files it configured. We see this with the [Remove dracut extend boot module](https://github.com/redhat-cop/infra.lvm_snapshots/blob/2.1.0/roles/bigboot/tasks/do_bigboot_reboot.yml#L23-L26) task that immediately follows the task including the `initramfs` role:
```yaml
- name: Remove dracut extend boot module
ansible.builtin.file:
path: /usr/lib/dracut/modules.d/99extend_boot
state: absent
```
The `shrink_lv` role of this collection is another [example](https://github.com/redhat-cop/infra.lvm_snapshots/blob/2.1.0/roles/shrink_lv/tasks/main.yaml#L13-L37) of using the `initramfs` role that you may study.

View File

@ -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,11 +22,15 @@
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: Reboot host
- name: Configure initramfs restore reboot cron
ansible.builtin.cron:
name: initramfs restore
cron_file: initramfs_restore
user: root
special_time: reboot
# yamllint disable-line rule:line-length
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.import_role:
name: verified_reboot
- 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

View File

@ -15,6 +15,7 @@
cmd: /sbin/grubby --default-kernel
register: initramfs_grubby_rc
changed_when: false
check_mode: false
- name: Parse default kernel version
ansible.builtin.set_fact:

View File

@ -1 +0,0 @@
shrink_lv_backup_extension: old

View File

@ -5,7 +5,6 @@
- name: Assert that the filesystem has shrunk
ansible.builtin.assert:
# yamllint disable-line rule:line-length
that: (shrink_lv_set_device['size_total'] | int) <= (item['size'] | ansible.builtin.human_to_bytes)
fail_msg: >
Logical Volume {{ item['device'] }} was NOT shrunk as requested.

View File

@ -2,10 +2,10 @@
- name: Make sure the required facts are available
ansible.builtin.setup:
gather_subset:
- "!all"
- "!min"
- kernel
- mounts
- "!all"
- "!min"
- kernel
- mounts
- name: Run preflight checks
ansible.builtin.include_tasks: preflight.yaml
@ -16,8 +16,8 @@
dest: /usr/lib/dracut/modules.d/99shrink_lv/
mode: "0554"
loop:
- module-setup.sh
- shrink.sh
- module-setup.sh
- shrink.sh
- name: Resolve and copy the shrink-start script
ansible.builtin.template:
@ -39,9 +39,9 @@
- name: Retrieve mount points
ansible.builtin.setup:
gather_subset:
- "!all"
- "!min"
- mounts
- "!all"
- "!min"
- mounts
- name: Check if device has shrunken successfully
ansible.builtin.include_tasks: check_if_shrunk.yml

View File

@ -1,3 +1,9 @@
- name: Validate default kernel is booted
ansible.builtin.include_role:
name: initramfs
tasks_from: preflight
when: snapshot_create_boot_backup
- name: Verify that all volumes exist
ansible.builtin.include_tasks: verify_volume_exists.yml
loop: "{{ snapshot_create_volumes }}"

View File

@ -0,0 +1,39 @@
# Testing the LVM Snapshot Role
## Prerequisites
- All the tests are in the form of ansible playbooks.
- All playbooks expect that the target machine will have a secondary storage device to be used for testing.
## Variables
The variables may be passed as part of the inventory or using a separate file.
```yaml
device: < device node without `/dev`. e.g. vdb >
```
## Ansible Configuration
In order to run the tests from the repo without having to install them,
the tests directory includes an [ansible.cfg](./ansible.cfg) file.
Make sure to point to it when running the test playbook
## Running a test
### Inventory file
In this example, the `device` parameter is passed in the `inventory.yml` file
```yaml
all:
hosts:
<FQDN of test machine>:
device: vdb
```
### Command line
Running the [snapshot revert playbook](./test-revert-playbook.yml) test from the repo
```bash
ANSIBLE_CONFIG=./tests/ansible.cfg ansible-playbook -K -i inventory.yml tests/test-revert-playbook.yml
```

View File

@ -0,0 +1,2 @@
[defaults]
roles_path=~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:../roles

View File

@ -0,0 +1,15 @@
- name: Generate snapshot list out of volumes list
ansible.builtin.set_fact:
_snapshots: "{{ (_snapshots | default([])) + [{'vg': volume_group, 'lv': item.name, 'size': item.size}] }}"
loop: "{{ volumes }}"
- name: Create the snapshot
vars:
snapshot_create_volumes: "{{ _snapshots }}"
snapshot_create_set_name: "{{ snapshot_set_name }}"
ansible.builtin.include_role:
name: snapshot_create
- name: Verify that the snapshot was created
ansible.builtin.include_tasks: verify-snapshot-created.yml
loop: "{{ volumes }}"

View File

@ -0,0 +1,40 @@
- name: Fill the volume
block:
- name: Set the retry count
ansible.builtin.set_fact:
_retry_count: "{{ (_retry_count | default('-1') | int) + 1 }}"
- name: Generate the Sub-Directory name
ansible.builtin.set_fact:
_sub_dir_name: "{{ lookup('community.general.random_string', upper=false, numbers=false, special=false) }}"
- name: Make a copy of the boot partition
ansible.builtin.copy:
src: /boot
dest: "{{ test_directory }}/{{ _sub_dir_name }}"
remote_src: true
mode: '0777'
- name: Get the status of the snapshot
ansible.builtin.command: "lvs --select 'lv_name = {{ volume_name }}_{{ snapshot_set_name }}' --reportformat json"
register: _lv_status_check
changed_when: false
- name: Store the snapshot data_percent
ansible.builtin.set_fact:
_snapshot_data_percent: "{{ ((_lv_status_check.stdout | from_json).report[0].lv[0].data_percent) }}"
- name: Check if snapshot is full enough
ansible.builtin.assert:
that: _snapshot_data_percent|float > snapshot_fill_percent|float
quiet: true
rescue:
- name: Check the retry count to avoid endless loop
ansible.builtin.assert:
that: (_retry_count|int) < (snapshot_max_retry|int)
fail_msg: "Ended after {{ snapshot_max_retry }} retries"
success_msg: "Volume is not full enough ({{ _snapshot_data_percent }}) - Run again..."
- name: Include the same tasks file again
ansible.builtin.include_tasks: fill-snapshot.yml

View File

@ -0,0 +1,11 @@
- name: Unmount the "{{ item.directory }}"
ansible.posix.mount:
path: "{{ item.directory }}"
state: absent
- name: Remove the logical volume
community.general.lvol:
vg: "{{ volume_group }}"
lv: "{{ item.name }}"
force: true
state: absent

View File

@ -0,0 +1,25 @@
- name: Cleanup the volumes
ansible.builtin.include_tasks: post-test-clean-volume.yml
loop: "{{ volumes }}"
- name: Remove the volume group
community.general.lvg:
vg: "{{ volume_group }}"
pvs: "/dev/{{ device }}1"
state: absent
- name: Remove the PV
ansible.builtin.command: "pvremove /dev/{{ device }}1"
changed_when: true
- name: Cleanup the system.devices file
ansible.builtin.lineinfile:
path: /etc/lvm/devices/system.devices
regexp: "IDTYPE=devname IDNAME=/dev/{{ device }}1 DEVNAME=/dev/{{ device }}1 PVID=. PART=1"
state: absent
- name: Delete the partition
community.general.parted:
device: "/dev/{{ device }}"
number: 1
state: absent

View File

@ -0,0 +1,18 @@
- name: Create the logical volume
community.general.lvol:
vg: "{{ volume_group }}"
lv: "{{ item.name }}"
size: "{{ item.size }}"
force: true
- name: Format the ext4 filesystem
community.general.filesystem:
fstype: ext4
dev: "/dev/{{ volume_group }}/{{ item.name }}"
- name: Mount the lv on "{{ item.directory }}"
ansible.posix.mount:
path: "{{ item.directory }}"
src: "/dev/{{ volume_group }}/{{ item.name }}"
fstype: ext4
state: mounted

View File

@ -0,0 +1,23 @@
- name: Create partition
community.general.parted:
device: "/dev/{{ device }}"
number: 1
part_end: 9GiB
flags:
- lvm
state: present
- name: Install lvm2 dependency
ansible.builtin.package:
name: lvm2
state: present
- name: Create the volume group
community.general.lvg:
vg: "{{ volume_group }}"
pvs: "/dev/{{ device }}1"
pesize: 16
- name: Create and prepare the volumes
ansible.builtin.include_tasks: pre-test-prepare-volume.yml
loop: "{{ volumes }}"

View File

@ -0,0 +1,24 @@
- name: Run lvs
ansible.builtin.command: lvs --select 'vg_name = {{ volume_group }} && origin = {{ item.name }}' --reportformat json
register: lvs_response
changed_when: false
- name: Parse report
ansible.builtin.set_fact:
lv_snapshot_array: "{{ (lvs_response.stdout | from_json).report[0].lv }}"
- name: Verify that the the snapshot exists
ansible.builtin.assert:
that: (lv_snapshot_array | length) == 1
fail_msg: >
The snapshot for {{ item.name }} was not created
- name: Get the snapshot name
ansible.builtin.set_fact:
snapshot_name: "{{ lv_snapshot_array[0].lv_name | default('n/a') }}"
- name: Verify that the the snapshot was named correctly
ansible.builtin.assert:
that: snapshot_name == item.name + '_' + snapshot_set_name
fail_msg: >
Snapshot name '{{ snapshot_name }}' is not as expected {{ item.name }}_{{ snapshot_set_name }}

View File

@ -0,0 +1,16 @@
- name: Run lvs
ansible.builtin.command: lvs --select 'vg_name = {{ volume_group }} && lv_name = {{ volume_name }}_{{ snapshot_set_name }}' --reportformat json
register: lvs_response
changed_when: false
- name: Parse report
ansible.builtin.set_fact:
lv_snapshot_report_array: "{{ (lvs_response.stdout | from_json).report[0].lv }}"
- name: Verify that the snapshot no longer exists
ansible.builtin.assert:
that: (lv_snapshot_report_array | length) == 0
fail_msg: >
The snapshot '{{ volume_name }}_{{ snapshot_set_name }}'' for
volume '{{ volume_name }}' in volume group '{{ volume_group }}'
still exists

View File

@ -0,0 +1,66 @@
#!/usr/bin/python3
# bigboot_size: "{{ bigboot_size_expansion_mb[:-2] | int | get_block_size_up }}"
class FilterModule (object):
def filters (self):
return {
'bigboot_fallback_size': self.bigboot_fallback_size,
'moo': self.moo,
}
def bigboot_fallback_size(self, fallback_size):
return ('{}{}'.format(fallback_size, 'M'))
def moo(self, a_variable):
a_new_variable = (str(a_variable) + '~~~~MOOOOOOOOOOOOOOOOOOOOOOOOO! => ' + '%s' % type(a_variable))
return a_new_variable
# import shutil
# import os
# def check_mount_space(mount_path, min_space_gb=1):
# try:
# # Get disk usage statistics for the mount point
# disk_usage = shutil.disk_usage(mount_path)
# # Convert bytes to gigabytes
# free_space_gb = disk_usage.free / (1024 ** 3)
# print(f"Mount point: {mount_path}")
# print(f"Free space: {free_space_gb:.2f} GB")
# if free_space_gb > min_space_gb:
# print("✓ More than 1GB available")
# return True
# else:
# print("✗ Less than 1GB available")
# return False
# except Exception as e:
# print(f"Error checking {mount_path}: {str(e)}")
# return False
# def check_all_mounts():
# # Read mount points from /proc/mounts
# with open('/proc/mounts', 'r') as f:
# mounts = f.readlines()
# results = []
# for mount in mounts:
# # Split the mount line and get the mount point (second field)
# mount_point = mount.split()[1]
# # Skip some virtual filesystems
# if mount_point.startswith(('/proc', '/sys', '/dev', '/run')):
# continue
# results.append(check_mount_space(mount_point))
# return results
# if __name__ == "__main__":
# print("Checking mount points for available space...")
# check_all_mounts()

View File

@ -7,7 +7,9 @@ class FilterModule (object):
return {
'get_block_size_up': self.get_block_size_up,
'get_block_size_down': self.get_block_size_down,
'moo': self.moo,
'get_block_size_up_bytes': self.get_block_size_up_bytes,
'get_block_size_down_bytes': self.get_block_size_down_bytes,
'moo': self.moo
}
@ -21,6 +23,16 @@ class FilterModule (object):
start_size -= 1
return ('{}{}'.format(start_size, 'M'))
def get_block_size_up_bytes(self, start_size):
while start_size % BLOCK_SIZE != 0:
start_size += 1
return ('{}'.format(start_size))
def get_block_size_down_bytes(self, start_size):
while start_size % BLOCK_SIZE != 0:
start_size -= 1
return ('{}'.format(start_size))
def moo(self, a_variable):
a_new_variable = (str(a_variable) + '~~~~MOOOOOOOOOOOOOOOOOOOOOOOOO! => ' + '%s' % type(a_variable))
return a_new_variable

View File

@ -1,10 +1,14 @@
#!/bin/bash
#
# pvsqueeze - Squeeze PEs into free holes
# pvsqueeze - Squeeze linear extents into free holes
#
# This script iteratively moves linear (allocated to LV) PEs to fill in free
# holes found in a PV segement map. The end result is that all free PEs are
# at the end of the PV. Use this script as required in anger!
# This script iteratively moves linear (allocated to LV) extents to fill in
# free holes found in a PV segment map. The end result is that all free
# extents are at the end of the PV. Use this script in anger as required!
#
# The script outputs the PV segment map before moving anything, then iterates
# stuffing extents in each free hole until there are no more except for the
# last one, and finally outputs the PV segment map again showing the changes.
#
# Usage
@ -51,6 +55,7 @@ while true; do
[[ $free_start -gt $move_start ]] && break
# Move last linear PEs to the free segment
[[ $free_size -gt $move_size ]] && free_size=$move_size
from_range="$pvdev:$((move_start+move_size-free_size))-$((move_start+move_size-1))"
to_range="$pvdev:$((free_start))-$((free_start+free_size))"
echo "Moving $from_range to $to_range..."

View File

@ -21,14 +21,6 @@
bigboot_expansion_diff:
"{{ bigboot_size_target | human_to_bytes - bigboot_boot_partsize | human_to_bytes }}"
- name: Convert size difference to MB
ansible.builtin.set_fact:
bigboot_size_expansion_mb: "{{ bigboot_expansion_diff | int | human_readable(unit='M') }}"
- name: Set bigboot size 4k aligned
ansible.builtin.set_fact:
bigboot_size: "{{ bigboot_size_expansion_mb[:-2] | int | get_block_size_up }}"
- name: Validate if we need to expand boot
block:
- name: Set flag for Bigboot execution
@ -42,10 +34,25 @@
success_msg: The /boot partition is already at the desired size
rescue:
- name: Set flag for Bigboot execution
ansible.builtin.set_fact:
bigboot_execute_bigboot: true
- name: "Check if /boot is already at or above {{ bigboot_size_min }}"
block:
- name: "Assert that /boot is already at or above {{ bigboot_size_min }}"
ansible.builtin.assert:
that: bigboot_boot_partsize | human_to_bytes >= bigboot_size_min | human_to_bytes
success_msg: >
/boot partition size is already at least {{ bigboot_size_min }}
or greater. Nothing to do."
fail_msg: >
/boot partition size is less than {{ bigboot_size_min }}.
Expansion of /boot is required.
- name: Expansion of /boot required
ansible.builtin.debug:
msg: "Will need to expand /boot by an additional {{ bigboot_size }}."
rescue:
- name: Set flag for Bigboot execution
ansible.builtin.set_fact:
bigboot_execute_bigboot: true
- name: Expansion of /boot required
ansible.builtin.debug:
msg: >
Will attempt to increase to {{ bigboot_size_target }}, or
{{ bigboot_size_min }} at the minimum."

View File

@ -42,14 +42,36 @@
bigboot_lv_info: "{{ ansible_facts.mounts \
| selectattr('device', 'equalto', bigboot_adjacent_lvm_device) | first }}"
- name: Assert that there is space on the logical volume for shrinkage
ansible.builtin.assert:
that: bigboot_lv_info.size_available > bigboot_expansion_diff | int
fail_msg: There is not enough space available for LV shrinking.
# - name: Assert that there is space on the logical volume for shrinkage
# ansible.builtin.assert:
# that: bigboot_lv_info.size_available > bigboot_expansion_diff | int
# fail_msg: There is not enough space available for LV shrinking.
- name: Capture shrink size for logical volume
- name: Capture UUID for target volume
ansible.builtin.set_fact:
bigboot_lv_shrink_size: "{{ bigboot_lv_info.size_total - bigboot_expansion_diff | int }}"
bigboot_lv_uuid: "{{ ansible_facts['mounts'] | selectattr('device', 'equalto', bigboot_adjacent_lvm_device) | map(attribute='uuid') | first }}"
- name: Capture block device information for target logical volume
ansible.builtin.set_fact:
bigboot_lv_dm: "{{ ansible_device_links['uuids'] | dict2items | selectattr('value', 'contains', bigboot_lv_uuid) | map(attribute='key') | first }}"
- name: Set initial sizes for logical volume and fallback size target
ansible.builtin.set_fact:
bigboot_lv_partsize: "{{ ansible_devices[bigboot_lv_dm]['sectors'] | int * ansible_devices[bigboot_lv_dm]['sectorsize'] | int }}"
bigboot_size_target_fallback: "{{ bigboot_size_target | human_to_bytes }}"
- name: Check available space and fallback to lower /boot size if required
ansible.builtin.include_tasks: check_space_fallback.yml
- name: Capture shrink and fallback sizes
ansible.builtin.set_fact:
# we need to get the BLOCK size total, not the filesystem
bigboot_lv_shrink_size: "{{ (bigboot_lv_partsize | int - bigboot_expansion_diff | int) | get_block_size_down_bytes }}"
bigboot_size_target_fallback: "{{ bigboot_size_target_fallback | int | human_readable(unit='G') | regex_replace('\\sGB', 'G') }}"
- name: Debug bigboot_lv_shrink_size and bigboot_size_target_fallback
ansible.builtin.debug:
msg: "{{ bigboot_lv_shrink_size | int | human_readable(unit='G') }} ({{ bigboot_lv_shrink_size | int | human_readable(unit='M') | regex_replace('\\.\\d+\\s+MB') | int | get_block_size_down }}) <-> {{ bigboot_size_target_fallback }} | {{ bigboot_expansion_diff }}"
- name: Capture logical volume name
ansible.builtin.shell:
@ -62,7 +84,7 @@
- name: Format logical volume name
ansible.builtin.set_fact:
bigboot_lv_vg_name: "{{ bigboot_lv_vg_name.stdout | regex_replace('VG\\s+Name\\s+(.*)$', '\\1') }}"
bigboot_lv_vg_name: "{{ bigboot_lv_vg_name['stdout'] | regex_replace('VG\\s+Name\\s+(.*)$', '\\1') }}"
- name: Capture volume group free PE
ansible.builtin.shell:
@ -73,6 +95,26 @@
changed_when: false
register: bigboot_lv_vg_free_pe
- name: Capture volume group PE size
ansible.builtin.shell:
cmd: |
set -o pipefail
vgdisplay {{ bigboot_lv_vg_name | trim }} | grep -i 'pe size'
executable: /bin/bash
changed_when: false
register: bigboot_lv_vg_pe_capture
- name: Set PE size
ansible.builtin.set_fact:
bigboot_lv_vg_pe_size: "{{ bigboot_lv_vg_pe_capture | regex_replace('^.*\\s+(\\d+.\\d+).*$', '\\1M') | human_to_bytes }}"
- name: Subtract one additional PE for shrinking
ansible.builtin.set_fact:
bigboot_lv_shrink_size: "{{ bigboot_lv_shrink_size | int - bigboot_lv_vg_pe_size | int }}"
# - name: Kill the play
# ansible.builtin.meta: end_host
- name: Capture the PV device
ansible.builtin.set_fact:
bigboot_pv: "{{ bigboot_boot_mount['device'][:-1] }}{{ bigboot_boot_mount['device'][-1:] | int + 1 }}"
@ -84,23 +126,24 @@
# Free PE / Size 189 / 756.00 MiB"
# Free PE / Size 414 / <1.62 GiB
# Free PE / Size 0 / 0
bigboot_lv_vg_free_pe: "{{ bigboot_lv_vg_free_pe.stdout | regex_replace('^.*/.*/\\s+[<]?(.*)', '\\1') }}"
bigboot_lv_vg_free_pe: "{{ bigboot_lv_vg_free_pe['stdout'] | regex_replace('^.*/.*/\\s+[<]?(.*)', '\\1') }}"
- name: Get size in MB for PE and
- name: Get size in MB for available PE
ansible.builtin.set_fact:
bigboot_lv_pe_size_in_mb:
"{{ bigboot_lv_vg_free_pe | regex_replace('i|\\s+|<', '') | human_to_bytes | human_readable(unit='M') }}"
- name: Verify available PE for the volume group
block:
- name: Set flag for Shrink_LV execution
- name: Set variables required for shrinking the target LV
ansible.builtin.set_fact:
bigboot_execute_shrink_lv: false
bigboot_expansion_diff_mb: "{{ bigboot_expansion_diff | int | human_readable(unit='M') }}"
- name: Assert if we need to execute the shrink_lv role to gain free PE
- name: Assert if we need to shrink the logical volume to gain PE
ansible.builtin.assert:
that: (bigboot_lv_pe_size_in_mb[:-3] | int | round) | int > bigboot_size[:-1] | int
fail_msg: Not enough PE to expand /boot.
that: (bigboot_lv_pe_size_in_mb[:-3] | int) >= (bigboot_expansion_diff_mb[:-3] | int)
fail_msg: Not enough PE to expand /boot. Will need to shrink target LV.
rescue:
- name: Set flag for Shrink_LV execution

View File

@ -0,0 +1,36 @@
---
- name: Debug bigboot_expansion_diff
ansible.builtin.debug:
msg: "{{ bigboot_expansion_diff }} + {{ bigboot_size_target_fallback }} <-> {{ bigboot_boot_partsize }}"
- name: Fail if /boot can't expand to at least 1GB
ansible.builtin.assert:
that: bigboot_size_target_fallback | int >= bigboot_size_min | human_to_bytes
fail_msg:
"{{ bigboot_size_target_fallback | int | human_readable(unit='M') }} is less than the minimum required size of {{ bigboot_size_min }}."
- name: Verify available space and re-check if needed
block:
- name: Assert that there is space on the logical volume for shrinkage
ansible.builtin.assert:
that: bigboot_lv_info['size_available'] > bigboot_expansion_diff | int
fail_msg: There is not enough free space available to shrink the filesystem
- name: Assert that there will be enough space left over on the target LV
ansible.builtin.assert:
that: (bigboot_lv_info['size_available'] - bigboot_expansion_diff | int) >= bigboot_lv_size_min | human_to_bytes
# success_msg: "There will be enough space left over with a boot size of {{ bigboot_size_target_fallback | int | human_readable(unit='G') }}. ({{ (bigboot_lv_info['size_total'] - bigboot_expansion_diff | int) | human_readable(unit='B') }})"
fail_msg: "There will NOT be enough space left over with a boot size of {{ bigboot_size_target_fallback | int | human_readable(unit='G') }}."
rescue:
- name: "Decrement size target by {{ bigboot_size_decrement }}"
ansible.builtin.set_fact:
bigboot_size_target_fallback: "{{ bigboot_size_target_fallback | int - bigboot_size_decrement | human_to_bytes }}"
- name: Update required expansion space
ansible.builtin.set_fact:
bigboot_expansion_diff:
"{{ (bigboot_size_target_fallback | int - bigboot_boot_partsize | human_to_bytes) }}"
- name: Re-check disk space - RESCUE
ansible.builtin.include_tasks: check_space_fallback.yml

View File

@ -40,11 +40,10 @@
# - name: Check for Bigboot state log and restore services to pre-Bigboot state
# ansible.builtin.import_tasks: tasks/restore_services.yml
# - name: Cleanup previous Bigboot state log if present
# ansible.builtin.file:
# path: "{{ bigboot_disabled_services_log }}"
# state: absent
# when:
# - bigboot_disabled_services_log_stat['stat']['exists'] | bool
- name: Cleanup old Bigboot service state log if present
ansible.builtin.file:
path: "{{ bigboot_disabled_services_log }}"
state: absent
...

View File

@ -6,4 +6,4 @@
- name: Include NFS export role
ansible.builtin.include_role:
name: rhc.rear.say_hi
name: rhc.rear.nfs_export

View File

@ -0,0 +1,9 @@
---
- name: Validate ReaR backup completion
ansible.builtin.command:
cmd: "grep 'Finished running mkbackup workflow' /var/log/rear/rear-{{ ansible_hostname }}.log"
register: validate_backup_log
- name: Debug validate_backup_log
ansible.builtin.debug:
var: validate_backup_log

View File

@ -1,37 +1,14 @@
---
ansible_ssh_retries: 10
bigboot_size_target: 1G
bigboot_size_target: 2G
bigboot_size_min: 1G
bigboot_size_decrement: 250M
bigboot_post_reboot_delay: 70
bigboot_reboot_timeout: 1800
bigboot_skip_rear_backup: false
# Max value in minutes for services timeout threshold:
bigboot_service_max_timeout: 5
# List of services incompatible with calculations
# to obtain required disk information:
#
# (These services will ALWAYS be disabled)
bigboot_incompatible_services:
- docker.service
- named-chroot.service
# List of services which will be excluded from being
# disabled during Bigboot execution:
#
# (Services listed in `bigboot_incompatible_services`
# will ALWAYS be disabled regardless if they are protected or not)
bigboot_protected_services:
- sshd.service
- user@0.service
- network
- rhnsd.service
- rhnsd
- boksm.service
- SplunkForwarder.service
bigboot_lv_size_min: 1G
# Filename of disabled services log:
bigboot_disabled_services_log: /var/ipe/ipu/el7to8/bigboot_disabled_services.log
bigboot_disabled_services_log: /var/IPE/IPU/el7to8/bigboot_disabled_services.log
# Define ReaR backup workflow:
rear_backup_workflow: bigboot

43
vars/bigboot_vars.yml.old Normal file
View File

@ -0,0 +1,43 @@
---
ansible_ssh_retries: 10
bigboot_size_target: 1G
bigboot_post_reboot_delay: 70
bigboot_reboot_timeout: 1800
bigboot_skip_rear_backup: false
# Max value in minutes for services timeout threshold:
bigboot_service_max_timeout: 5
# List of services incompatible with calculations
# to obtain required disk information:
#
# (These services will ALWAYS be disabled)
bigboot_incompatible_services:
- docker.service
- named-chroot.service
# List of services which will be excluded from being
# disabled during Bigboot execution:
#
# (Services listed in `bigboot_incompatible_services`
# will ALWAYS be disabled regardless if they are protected or not)
bigboot_protected_services:
- sshd.service
- user@0.service
- network
- rhnsd.service
- rhnsd
- boksm.service
- SplunkForwarder.service
# Filename of disabled services log:
bigboot_disabled_services_log: /var/ipe/ipu/el7to8/bigboot_disabled_services.log
bigboot_backup_success_path: "/var/log/IPE/IPU"
bigboot_backup_success_file: "{{ bigboot_backup_success_path }}/bigboot_rear_success"
bigboot_nfs_backup_share: "/backups/bigboot"
bigboot_nfs_backup_share_fsid: 20