initial changes and cleanup prior to service management code
This commit is contained in:
parent
4b15e3396b
commit
25c7c4a19e
37
bigboot-check-device-debug.yml
Normal file
37
bigboot-check-device-debug.yml
Normal file
@ -0,0 +1,37 @@
|
||||
---
|
||||
- name: Capture boot and logical volume information
|
||||
hosts: all
|
||||
become: true
|
||||
gather_facts: true
|
||||
strategy: free
|
||||
|
||||
vars:
|
||||
shrink_lv_device: "/dev/mapper/system-root"
|
||||
|
||||
tasks:
|
||||
- name: Get the mount point info
|
||||
ansible.builtin.set_fact:
|
||||
shrink_lv_mount_info: "{{ ansible_facts.mounts | selectattr('device', 'equalto', shrink_lv_device) }}"
|
||||
|
||||
- name: Assert that the mount point exists
|
||||
ansible.builtin.assert:
|
||||
that: (shrink_lv_mount_info | length) == 1
|
||||
fail_msg: "Mount point {{ shrink_lv_device }} does not exist"
|
||||
|
||||
- name: Get logical volume mount information
|
||||
ansible.builtin.set_fact:
|
||||
bigboot_lv_info: "{{ ansible_facts.mounts \
|
||||
| selectattr('device', 'equalto', shrink_lv_device) }}"
|
||||
|
||||
- name: Assert that the mount point exists
|
||||
ansible.builtin.assert:
|
||||
that: (bigboot_lv_info | length) == 1
|
||||
fail_msg: "Mount point {{ shrink_lv_device }} does not exist"
|
||||
|
||||
- name: Debug shrink_lv_mount_info
|
||||
ansible.builtin.debug:
|
||||
var: shrink_lv_mount_info
|
||||
|
||||
- name: Debug bigboot_lv_info
|
||||
ansible.builtin.debug:
|
||||
var: bigboot_lv_info
|
@ -1,13 +1,12 @@
|
||||
---
|
||||
- name: Capture boot and logical volume information
|
||||
- name: Perform logical volume and boot parition resizing as needed
|
||||
hosts: all
|
||||
become: true
|
||||
gather_facts: true
|
||||
strategy: free
|
||||
|
||||
vars:
|
||||
bigboot_size_target: 1G
|
||||
|
||||
vars_files:
|
||||
- bigboot_vars.yml
|
||||
|
||||
tasks:
|
||||
- name: Cleanup from any previous executions
|
||||
@ -24,6 +23,7 @@
|
||||
ansible.builtin.import_playbook: rhc.rear.rear_backup
|
||||
when:
|
||||
- bigboot_execute_bigboot | bool
|
||||
- not bigboot_skip_rear_backup | bool
|
||||
|
||||
|
||||
- name: Perform logical volume and boot parition resizing as needed
|
||||
|
@ -5,6 +5,9 @@
|
||||
gather_facts: true
|
||||
strategy: free
|
||||
|
||||
vars_files:
|
||||
- bigboot_vars.yml
|
||||
|
||||
tasks:
|
||||
- name: Perform filesystem check prior to Bigboot execution
|
||||
when:
|
||||
|
@ -1,8 +1,18 @@
|
||||
---
|
||||
- name: Perform a ReaR backup if any disk modifications are to be made
|
||||
ansible.builtin.import_playbook: rhc.rear.rear_backup
|
||||
when:
|
||||
- bigboot_execute_bigboot | bool
|
||||
- not bigboot_skip_rear_backup | bool
|
||||
- name: Perform a ReaR backup
|
||||
hosts: all
|
||||
become: true
|
||||
gather_facts: true
|
||||
strategy: free
|
||||
|
||||
vars_files:
|
||||
- bigboot_vars.yml
|
||||
|
||||
tasks:
|
||||
- name: Perform a ReaR backup if any disk modifications are to be made
|
||||
ansible.builtin.import_playbook: rhc.rear.rear_backup
|
||||
when:
|
||||
- bigboot_execute_bigboot | bool
|
||||
- not bigboot_skip_rear_backup | bool
|
||||
|
||||
...
|
||||
|
@ -5,9 +5,8 @@
|
||||
gather_facts: true
|
||||
strategy: free
|
||||
|
||||
vars:
|
||||
bigboot_size_target: 1G
|
||||
ansible_ssh_retries: 10
|
||||
vars_files:
|
||||
- bigboot_vars.yml
|
||||
|
||||
tasks:
|
||||
- name: Cleanup from any previous executions
|
||||
|
40
tasks/check_systemd_services.yml
Normal file
40
tasks/check_systemd_services.yml
Normal file
@ -0,0 +1,40 @@
|
||||
---
|
||||
- name: Verify Middleware Apache package presence
|
||||
ansible.builtin.service_facts:
|
||||
|
||||
- name: Capture a list of running services
|
||||
ansible.builtin.set_fact:
|
||||
bigboot_systemd_running_services:
|
||||
"{{ bigboot_systemd_running_services | default([]) + [item['key']] }}"
|
||||
loop: "{{ ansible_facts['services'] | dict2items }}"
|
||||
loop_control:
|
||||
label: "{{ item['key'] }}"
|
||||
when:
|
||||
- "'running' in item['value']['state']"
|
||||
|
||||
- name: Get stop timeout value for running services
|
||||
ansible.builtin.shell:
|
||||
cmd: |
|
||||
set -o pipefail
|
||||
systemctl show {{ item }} | grep TimeoutStopUSec
|
||||
changed_when: false
|
||||
register: bigboot_systemd_service_timeout
|
||||
loop: "{{ bigboot_systemd_running_services }}"
|
||||
|
||||
- name: Disable services exceeding the timeout threshold
|
||||
when:
|
||||
- item['item'] not in bigboot_protected_services
|
||||
- item['stdout'] | regex_replace('^.*=(.*$)', '\\1') | community.general.to_minutes > bigboot_service_max_timeout
|
||||
block:
|
||||
- name: Disabling services exceeding the timeout threshold
|
||||
ansible.builtin.include_tasks: tasks/disable_systemd_services.yml
|
||||
loop: "{{ bigboot_systemd_service_timeout['results'] }}"
|
||||
loop_control:
|
||||
label: "{{ item['item'] }}"
|
||||
|
||||
- name: Re-enabling services previously disabled
|
||||
ansible.builtin.service:
|
||||
name: "{{ item }}"
|
||||
state: started
|
||||
enabled: true
|
||||
loop: "{{ bigboot_systemd_disabled_services }}"
|
11
tasks/disable_systemd_services.yml
Normal file
11
tasks/disable_systemd_services.yml
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
- name: Disabling service for exceeding the timeout threshold
|
||||
ansible.builtin.service:
|
||||
name: "{{ item['item'] }}"
|
||||
state: stopped
|
||||
enabled: false
|
||||
|
||||
- name: Append service to list of disabled services
|
||||
ansible.builtin.set_fact:
|
||||
bigboot_systemd_disabled_services:
|
||||
"{{ bigboot_systemd_disabled_services | default([]) + [item['item']] }}"
|
15
vars/bigboot_vars.yml
Normal file
15
vars/bigboot_vars.yml
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
bigboot_size_target: 1G
|
||||
ansible_ssh_retries: 10
|
||||
|
||||
# Max value in minutes for the timeout threshold:
|
||||
bigboot_service_max_timeout: 2
|
||||
|
||||
# List of services which will be excluded from being disabled:
|
||||
bigboot_protected_services:
|
||||
- sshd.service
|
||||
- user@0.service
|
||||
- network
|
||||
- rhnsd.service
|
||||
# - rhnsd
|
||||
- boksm.service
|
Loading…
x
Reference in New Issue
Block a user