Files
Ansible/playbooks/maintenance_start_stopped_services.yml
T
2026-09-22 19:23:17 +02:00

38 lines
1.6 KiB
YAML

---
# PURPOSE: Start stopped automatic services
# DESCRIPTION: Start eligible stopped services, apply optional include/exclude lists and report partial failures.
# TARGETS: windows
# INPUTS (omitted values inherit inventory / role defaults):
# aim_debug [bool]: false
# maintenance_service_include [list]: []
# maintenance_service_exclude [list]: []
# maintenance_service_fail_on_error [bool]: true
# AUTH: existing inventory / Vault credentials; no embedded passwords.
# EXAMPLE: ansible-playbook -i inventories/<customer>/hosts.yml
# playbooks/maintenance_start_stopped_services.yml --limit <host> --vault-id <customer>@prompt
- name: Maintenance | Start automatic services
hosts: windows
gather_facts: false
pre_tasks:
- name: AIM | Validate diagnostics option
ansible.builtin.assert:
that:
- (aim_debug | default(false)) is boolean or (aim_debug | default(false) | string | lower) in ['true',
'false']
fail_msg: aim_debug must be a YAML/JSON boolean.
quiet: true
- name: AIM | Reject mixed platform membership
ansible.builtin.assert:
that:
- (group_names | intersect(['linux', 'windows', 'sophosxgs', 'pfsense']) | length) <= 1
fail_msg: This host belongs to incompatible platform groups. Use globally unique subgroups.
quiet: true
- name: AIM | Execution context
ansible.builtin.debug:
msg:
host: '{{ inventory_hostname }}'
diagnostics: Enabled; secret values are never included by this task.
when: aim_debug | default(false) | bool
roles:
- role: maintenance_start_stopped_services