Sync with Develop #7
@ -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
|
||||
|
@ -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
29
tasks/pre-checks.yml
Normal 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.
|
Loading…
x
Reference in New Issue
Block a user