Sync with Develop #7

Merged
chris merged 38 commits from develop into main 2025-01-08 16:44:32 -05:00
3 changed files with 37 additions and 3 deletions
Showing only changes of commit 035fc1b57c - Show all commits

View File

@ -21,6 +21,11 @@
- 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
- name: Set environment for subsequent workflow nodes
ansible.builtin.set_stats:
aggregate: true

View File

@ -1,18 +1,18 @@
---
- name: Save service state
- name: "Save service state: {{ item }}"
ansible.builtin.set_fact:
bigboot_service_to_disable:
service: "{{ ansible_facts['services'][item]['name'] }}"
state: "{{ (ansible_facts['services'][item]['state'] == 'running') | ternary('started', 'stopped') }}"
status: "{{ (ansible_facts['services'][item]['status'] == 'enabled') | ternary('true', 'false') }}"
- name: Disable and stop service
- name: "Disable and stop service: {{ item }}"
ansible.builtin.service:
name: "{{ item }}"
state: stopped
enabled: false
- name: Log disabled service state
- name: "Log disabled service state: {{ item }}"
ansible.builtin.lineinfile:
path: "{{ bigboot_disabled_services_log }}"
line: "{{ item }},{{ bigboot_service_to_disable['state'] }},{{ bigboot_service_to_disable['status'] }}"

29
tasks/pre-checks.yml Normal file
View File

@ -0,0 +1,29 @@
---
- name: Get /boot mount information
ansible.builtin.set_fact:
bigboot_boot_mount: "{{ ansible_facts.mounts \
| selectattr('mount', 'equalto', '/boot') | first }}"
- name: Set next partition after /boot
ansible.builtin.set_fact:
bigboot_next_device: "{{ bigboot_boot_mount['device'][:-1] }}{{ bigboot_boot_mount['device'][-1:] | int + 1 }}"
- name: Capture partition information from fdisk
ansible.builtin.shell:
cmd: |
set -o pipefail
fdisk -l {{ bigboot_boot_mount['device'][:-1] }} | grep '{{ bigboot_next_device }}'
executable: /bin/bash
changed_when: false
failed_when: bigboot_fdisk_partition['rc'] not in [0, 141]
register: bigboot_fdisk_partition
- name: Debug bigboot_fdisk_partition
ansible.builtin.debug:
var: bigboot_fdisk_partition
- name: Assert that the partition following /boot is of type LVM
ansible.builtin.assert:
that: "'Linux LVM' in bigboot_fdisk_partition['stdout']"
success_msg: The partition following /boot is an LVM partition
fail_msg: The partition following /boot is NOT an LVM partition. Execution halted.