cleanup and add code block

This commit is contained in:
Chris Hammer 2024-08-07 10:17:05 -04:00
parent e7e90aaaf5
commit 684c1bef51
3 changed files with 18 additions and 23 deletions

View File

@ -12,9 +12,6 @@
- name: Cleanup from any previous executions - name: Cleanup from any previous executions
ansible.builtin.import_tasks: tasks/cleanup.yml ansible.builtin.import_tasks: tasks/cleanup.yml
- name: Ensure service facts are available
ansible.builtin.service_facts:
- name: Check for services that require being disabled - name: Check for services that require being disabled
ansible.builtin.import_tasks: tasks/check_services.yml ansible.builtin.import_tasks: tasks/check_services.yml

View File

@ -1,4 +1,7 @@
--- ---
- name: Ensure service facts are available
ansible.builtin.service_facts:
- name: Capture a list of running services - name: Capture a list of running services
ansible.builtin.set_fact: ansible.builtin.set_fact:
bigboot_systemd_running_services: bigboot_systemd_running_services:
@ -33,21 +36,21 @@
bigboot_services_disabled: "{{ bigboot_services_disabled | default([]) + [item] }}" bigboot_services_disabled: "{{ bigboot_services_disabled | default([]) + [item] }}"
loop: "{{ bigboot_incompatible_services }}" loop: "{{ bigboot_incompatible_services }}"
when: when:
- item not in bigboot_protected_services
- ansible_facts['services'][item] is defined - ansible_facts['services'][item] is defined
- ansible_facts['services'][item]['state'] == "running" - ansible_facts['services'][item]['state'] == "running"
- name: Log and disable services - name: Log and disable services
ansible.builtin.include_tasks: tasks/disable_systemd_services.yml
loop: "{{ bigboot_services_disabled }}"
when:
- bigboot_services_disabled is defined
- name: Services disabled notice
ansible.builtin.debug:
msg: >-
The following services were disabled, and will be re-enabled post
Bigboot execution: {{ bigboot_services_disabled | join(', ') }}
when: when:
- bigboot_services_disabled is defined - bigboot_services_disabled is defined
- bigboot_services_disabled | length > 0 - bigboot_services_disabled | length > 0
block:
- name: Disable services and log their state
ansible.builtin.include_tasks: tasks/disable_systemd_services.yml
loop: "{{ bigboot_services_disabled }}"
- name: Services disabled notice
ansible.builtin.debug:
msg: >-
The following services were disabled, and will be re-enabled post
Bigboot execution: {{ bigboot_services_disabled | join(', ') }}

View File

@ -8,14 +8,6 @@ bigboot_reboot_timeout: 1800
bigboot_skip_rear_backup: false bigboot_skip_rear_backup: false
bigboot_docker_service: docker.service
bigboot_docker_running: stopped
bigboot_docker_enabled: false
bigboot_named_chroot_service: named-chroot.service
bigboot_named_chroot_running: stopped
bigboot_named_chroot_enabled: false
# Max value in minutes for services timeout threshold: # Max value in minutes for services timeout threshold:
bigboot_service_max_timeout: 5 bigboot_service_max_timeout: 5
@ -29,6 +21,9 @@ bigboot_incompatible_services:
# List of services which will be excluded from being # List of services which will be excluded from being
# disabled during Bigboot execution: # disabled during Bigboot execution:
#
# (Services listed in `bigboot_incompatible_services`
# will ALWAYS be disabled regardless if they are protected or not)
bigboot_protected_services: bigboot_protected_services:
- sshd.service - sshd.service
- user@0.service - user@0.service
@ -36,7 +31,7 @@ bigboot_protected_services:
- rhnsd.service - rhnsd.service
- rhnsd - rhnsd
- boksm.service - boksm.service
# - <add splunk service on wells> - SplunkForwarder.service
# Filename of disabled services log: # 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